Default exception handler
| From: | (Marcus Börger) | Date: | Fri, 05 Sep 2003 15:24:21 +0000 |
| Subject: | Default exception handler | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-4394@lists.php.net to get a copy of this message | ||
Hello internals, hi Zeev, hi Andi,
Currently php doesn't have a default exception handler that gets executed
if the thrown excpetion was not caught by any previous handler. I now
suggest the following extension:
try {
// code
}
catch (class1 $var) {
}
catch (class2 $var) {
}
catch ($var) {
}
Thereby it should only be possible to have an exception handler that does
not specify a class as the last one. Since we only allow throwing objects at
the moment we know that the caught variable is any object and hence we do
not need a syntax like catch (...) provided by C++ for example.
An alternative concept would be to allow throwing exception instances only.
But inside the C code you could still throw other objects.
A patch to enable the new syntax can be found here:
http://marcus-boerger.de/php/ext/ze2/ze2-catch-20030905.diff.txt
Best regards,
Marcus mailto:marcus.boerger@post.rwth-aachen.de