Re: Exceptions and Errors
| From: | Adam Maccabee Trachtenberg | Date: | Tue, 13 Apr 2004 21:15:11 +0000 |
| Subject: | Re: Exceptions and Errors | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9125@lists.php.net to get a copy of this message | ||
On Tue, 13 Apr 2004, Marcus Boerger wrote:
> > In PHP 4, E_ERROR is fatal. In PHP 5, E_ERROR is (currently) also
> > fatal. This always happens regardless of any exception handling.
>
> > With exceptions, we have the ability to modify E_ERRORs to be
> > non-fatal.
>
> Not at the moment.
Ah. Okay. I guess I was confused by:
> 1) convert the non continuable E_ERRORs to a higher severity (if there
> are any at all)
So what you're saying is that some problems that are classified (by a
developer) as E_ERRORs aren't actually fatal to PHP even though right
now PHP treats them as such. (Like an E_ERROR for passing the wrong
number of parameters to a function.)
But, since these problems are probably still "very bad," they're the
type of errors that are best handled by exceptions.
Therefore, you propose to promote non-recoverable errors to E_FATAL
(or whatever) and keep the recoverable E_ERRORs where they are. Then,
when an E_ERROR occurs, it's thrown as an exception? (I'm not sure if
you're saying this.)
If the developer catches it, they handle it. If they don't, PHP
catches it and issues a fatal error.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!