db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: [jira] Commented: (DERBY-2472) Use Throwable.initCause() to improve error reporting
Date Mon, 21 May 2007 14:32:36 GMT

Thanks for the very clear explanation, Knut Anders!

> As I can't see that the subsequent exceptions will provide any
> significant value, I'm tempted to go for this solution. The code will be
> a lot simpler this way, and I think it would also be clearer what the
> problem is if an exception is thrown. As it is today, the last exception
> we caught is the one that is re-thrown. This exception may have a
> message that is completely unrelated to the real error, which you only
> see if you go to the end of the chain.

+1 to all of these conclusions. The first exception is the most
important, and attempting to amalgamate multiple exception chains
into a single chain can mislead the user. Re-throwing the last exception
seems like an inferior choice to re-throwing the first.

Possibly it would be worth renaming the variable from 'topLevelStandardException'
to 'firstExceptionCaught', or 'exceptionToReThrow' or something like that,
with a comment capturing that the operation continues on an exception
and delays the re-throwing until the operation has completed.

Thanks again for taking the time to clarify how this code works.


View raw message