Re: Exceptions and Errors
| From: | cm at leetspeak dot org | Date: | Mon, 12 Apr 2004 18:14:55 +0000 |
| Subject: | Re: Exceptions and Errors | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9082@lists.php.net to get a copy of this message | ||
>
> On Apr 12, 2004, at 10:58 AM, Adam Maccabee Trachtenberg wrote:
>
>> On Mon, 12 Apr 2004, Ilia Alshanetsky wrote:
>>
>>> There is 1 problem with this approach. Currently an uncaught
>>> exceptions
>>> results in a fatal error (E_ERROR) meaning that if a particular
>>> method throws
>>> an exceptions it MUST be caught otherwise the script will terminate.
>>> Having
>>> to wrap some methods inside exceptions can be extremely frustrating
>>> since you
>>> may want to allow those methods to fail.
>>
>> Yes. This sucks. Maybe PHP should only issue exceptions for problems
>> of E_WARNING severity. An exception is an "Exceptional Event." If you
>> have an E_NOTICE or E_STRICT then that's an informational event, not a
>> exceptional one.
>
> I'm fine with this, but it's really just a documentation problem,
> right? Your method can still fail, you just need to try/catch around
> it.
>
> try {
> $obj->bornToFail();
> }
> catch(Exception $e){}
>
> Uglier than just swallowing a warning for sure, but still just a doc
> problem.
Might there be a possibility that an exception inside a "@ context" could
be ignored, too (that might also work with active custom error handlers,
I guess)?
Cheers,
Michael