[armedbear-devel] Review of exception handling ["catch (Throwable"]
Erik Huelsmann
ehuels at gmail.com
Fri Dec 25 22:50:35 UTC 2009
Last weeks I did a full review of our code base of uses of "catch
(Throwable" as a means of catching anything and "just continuing from
there".
It seems our code was relatively unpredictable, because in some sites
it would throw a debugging exeption, whereas in others processing
would continue. With the change where ControlTransfer is now an
unchecked exception, it turns out most of the try/catch blocks were
unnecessary anyway; most of them have been removed or made more
specific (IOException, mostly).
The remaining ones seem to have a function, however, everybody is
invited to see if I didn't forget or misjudge some locations.
With the removal, there's a new instability, it seems: when using the
IGNORE-ERRORS macro, one expects the code inside it to catch all
errors and continue processing after it, no matter what the error.
However, since we no longer catch Throwable and therefore no longer
catch any of the RuntimeExceptions, it turns out IGNORE-ERRORS leaks
all runtime exceptions. Arguably it shouldn't leak
StackOverflowException and many others: these might be *the*
conditions to continue after IGNORE-ERRORS.
So, I think we need to implement some construct to catch all java
exceptions raised inside it and convert them to Lisp errors. This can
then be included in IGNORE-ERRORS.
Comments?
Bye,
Erik.
More information about the armedbear-devel
mailing list