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
Hello Davey,
Tuesday, August 31, 2004, 8:41:45 AM, you 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.
An exception means that the current execution block cannot be
continued and incase that block is not a try block then the stack
is wound up and the next block is skipped until a try block with
a matching catch block is found. The 'cannot' means 'cannot' dot.
If you want to continue from some exceptional behavior than what
you want is some kind of error callback or interrupt. And if one
of those fits then exception are the absolute wrong way. So you
should redesign your software and please never use exceptions for
control flow or parameter passing and never make it a standard
in any way to use exceptions - they are exceptions.
marcus
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
Amen :)
At 09:03 PM 8/31/2004 +0200, Marcus Boerger wrote:
Hello Davey,
Tuesday, August 31, 2004, 8:41:45 AM, you 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.An exception means that the current execution block cannot be
continued and incase that block is not a try block then the stack
is wound up and the next block is skipped until a try block with
a matching catch block is found. The 'cannot' means 'cannot' dot.
If you want to continue from some exceptional behavior than what
you want is some kind of error callback or interrupt. And if one
of those fits then exception are the absolute wrong way. So you
should redesign your software and please never use exceptions for
control flow or parameter passing and never make it a standard
in any way to use exceptions - they are exceptions.marcus