Bryan Pendleton <[EMAIL PROTECTED]> writes: > 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.
Thank you, Bryan! That sounds like a good idea. -- Knut Anders
