Re: Error handling brainstorming
| From: | Derick Rethans | Date: | Mon, 27 Aug 2012 12:29:58 +0000 |
| Subject: | Re: Error handling brainstorming | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62562@lists.php.net to get a copy of this message | ||
On Fri, 3 Aug 2012, Ferenc Kovacs wrote:
> Basically Etienne mentioned that the original issue was a good example why
> would we reconsider throwing exceptions from the core, which is currently
> discouraged.[2]
> Stan replied with the idea of turning the current error handling mechanism
> in php into using Exceptions for everything, but keeping some error types
> as is/uncatchable. [3]
This is going to be the biggest BC break *ever*. Instead of harmless
notices and warnings that people will and can (and sometimes should)
ignore, the moment any of those happens, the script will suddendly
because the exception isn't caught.
> > Andrew:
> From your mails, it seems that you don't agree with Stan on turning
> everything but fatals into exceptions[9].
That's a funny one. The only thing that currently makes sense to use an
exception for is the E_RECOVERABLE - that is, without potentionally
breaking any script that's ever been written.
> So basically these are our boundaries:
>
> - Fatal errors can't be turned into Exceptions, but it was mentioned
> multiple times, that there are some fatals, which could be turned into
> E_RECOVERABLE_ERROR.
Some, but definitely not many. When we introduced E_RECOVERABLE we had a
good look at them all.
> - Most/all non-fatal errors could be safe to be turned into Exceptions
> as without explicit measures(try-catch) on the caller's side, it would
> still stop the execution.
And hence break the script...
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug