Re: [VOTE] Exceptions in the engine
| From: | Julien Pauli | Date: | Wed, 13 May 2015 12:51:52 +0000 |
| Subject: | Re: [VOTE] Exceptions in the engine | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86192@lists.php.net to get a copy of this message | ||
On Wed, May 13, 2015 at 9:38 AM, Sebastian Bergmann <sebastian@php.net>
wrote:
> Am 13.05.2015 um 08:30 schrieb Pierre Joye:
> > Why don't you do it? You have access and you are a very good writer.
> > No big C knowledge required either in this case :)
>
> There was/is consensus on what I proposed back in February:
>
> * Introduce a Throwable interface
> * Let Exception implement the Throwable interface
> * Introduce an Error class that implements the Throwable interface
> * Use Error class as base class for exceptions raised by the engine
>
> But as simple as the above sounds it is complicated (at least for
> me) to implement (properly). Here's what I was able to come up with:
>
> https://github.com/php/php-src/pull/1274
>
> This should give us the following:
>
> interface Throwable {}
> abstract class BaseException implements Throwable {}
> class Exception extends BaseException {}
> class Error extends BaseException {}
> class EngineError extends Error {}
> class ParseError extends Error {}
> class TypeError extends Error {}
>
> I am not sure whether we still want the abstract BaseException
> class. I left it in because I couldn't figure out how to remove
> it without breaking Exception and Error.
>
> Added my comments inline on the PR :-)
Julien