qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rupert Smith" <rupertlssm...@googlemail.com>
Subject More Bad Exception Handling.
Date Mon, 09 Apr 2007 13:40:22 GMT
Yes, there's quite a lot of it in there. I'm going to leave some of it well
alone for the moment, but fix some things that don't really alter the
semantics of the code:

Here's one. Don't do this:

catch (SomeException e)
   throw new MyException("Something went wrong.");

Do this instead:

catch (SomeException e)
  throw new MyException("Something went wrong.", e);

of for JMSException which doesn't accept wrapped exceptions through its
constructors, have to do something like:

catch (SomeException e)
  JMSException jmse = new JMSException("Something went wrong.");
  throw jmse;

This isn't majorly wrong, just annoying to lose half the exception stack
trace, when tracking down bugs from log files.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message