Hi,
In experimenting with exceptions, I notice that throw() always jumps to
the first catch() (as expected), and there is no way to return to the
line after the throw(). Are we forced to use trigger_error() or some
custom function for this kind of exception, or is there a way to tell
PHP 5 "go back, the exception is fixed"?
Thanks,
Greg
In experimenting with exceptions, I notice that throw() always jumps to
the first catch() (as expected), and there is no way to return to the
line after the throw().
That is precisely how exceptions are supposed to work.
Are we forced to use
trigger_error()or some
custom function for this kind of exception,
trigger_error() != exception.
or is there a way to tell
PHP 5 "go back, the exception is fixed"?
Nope. You need to use separate try/catch blocks if you need more
granularity.
try {
try {
do_something();
} catch (exception $e) {
// ignore it
}
do_something_else();
} catch (exception $e) {
var_dump($e);
}
--Wez.
That's not the way exceptions work in any language I know.
Hi,
In experimenting with exceptions, I notice that throw() always jumps
to the first catch() (as expected), and there is no way to return to
the line after the throw(). Are we forced to usetrigger_error()or
some custom function for this kind of exception, or is there a way to
tell PHP 5 "go back, the exception is fixed"?Thanks,
Greg--
-- George Schlossnagle
-- Principal Consultant
-- OmniTI Computer Consulting, Inc.
-- +1.410.872.4910 x202
-- 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0
You should not use exceptions for program logic. Exceptions are use to
handle exceptional cases and the overhead of handling an exception may
be quite expensive. At least on other languages.
So, what is the overhead of throwing exceptions in PHP? Is it as
expensive as in .Net or C++?
-----Original Message-----
From: Greg Beaver [mailto:greg@chiaraquartet.net]
Sent: Tuesday, July 08, 2003 1:30 PM
To: internals@lists.php.net
Subject: [PHP-DEV] exceptions question
Hi,
In experimenting with exceptions, I notice that throw() always jumps to
the first catch() (as expected), and there is no way to return to the
line after the throw(). Are we forced to use trigger_error() or some
custom function for this kind of exception, or is there a way to tell
PHP 5 "go back, the exception is fixed"?
Thanks,
Greg
Yes, it is expensive.
Andi
At 08:57 PM 9/7/2003 -0400, Juan C. Rivera wrote:
You should not use exceptions for program logic. Exceptions are use to
handle exceptional cases and the overhead of handling an exception may
be quite expensive. At least on other languages.So, what is the overhead of throwing exceptions in PHP? Is it as
expensive as in .Net or C++?-----Original Message-----
From: Greg Beaver [mailto:greg@chiaraquartet.net]
Sent: Tuesday, July 08, 2003 1:30 PM
To: internals@lists.php.net
Subject: [PHP-DEV] exceptions questionHi,
In experimenting with exceptions, I notice that throw() always jumps to
the first catch() (as expected), and there is no way to return to the
line after the throw(). Are we forced to usetrigger_error()or some
custom function for this kind of exception, or is there a way to tell
PHP 5 "go back, the exception is fixed"?Thanks,
Greg