Re: [RFC] Throwable Interface
| From: | Aaron Piotrowski | Date: | Wed, 10 Jun 2015 14:37:44 +0000 |
| Subject: | Re: [RFC] Throwable Interface | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86551@lists.php.net to get a copy of this message | ||
> On Jun 10, 2015, at 2:37 AM, Dmitry Stogov <dmitry@zend.com> wrote:
>
> I also like EngineException more than Error.
>
I think EngineException has a couple of problems with it:
1) EngineException doesn’t really accurately represent the reason for the error. For
example, passing the wrong type to a function isn’t an ‘engine' problem, it’s an
error in user code. In the future it may be desirable to add more classes in this
exception branch, and I think a more general name would be more desirable.
2) The name EngineException implies it descends from Exception. I worry that this
will cause a lot of confusion for users thinking they have to be catching Exceptions
when the problem is actually an error in their code. Discussing why you should not
catch Error objects is easier than trying to explain why certain Exception objects
should not be caught.
Error is best choice for the name of the second exception branch. It has precedent
in other languages and is less likely to cause confusion. Most user code that would
collide with the name is likely very outdated, but still could easily be updated in
only a few minutes.
Regards,
Aaron Piotrowski