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.

Either that or uncaught exceptions should be E_WARNINGs instead of
E_ERRORs. (I don't want to introduce Java's checked versus unchecked
exception concept.)

-1.


George

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to