Hi Davey,
You should use try/catch in order to catch exceptions. set_exception_handler() is only meant for you to be able to handle uncaught exception before PHP dies (i.e.allow you to output an error message page).
I think your idea goes very much against what exceptions stand for which is allowing to unwind the stack in an easy way to whatever place is willing to handle the exception.
Andi
At 02:41 AM 8/31/2004 -0400, Davey wrote:
Dear all,
I would like to request that set_exception_handler's behaviour be changed. IMHO it should not die after handling an exception.
I feel that most users will expect this behaviour to be synonymous (i.e. both should echo "foo"):
try { throw someException; } catch (someException $e) { }
echo "foo";
and:
throw someExceptionThatIsCaughtBySetExceptionHandler;
echo "foo";
Derick has expressed that all uncaught exceptions should cause an E_ERROR, and I agree, however I feel that set_exception_handler means that the exception is handled, just by a default function (say, a logger).
There is currently a rather large (and heated) debate on pear-dev about how to not get in a mess with PHP5 error handling, and I have proposed a nice solution (IMO) which relies on the behaviour I propose.
- Davey
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php