activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject making ExceptionListener#onException behave based on Exception type
Date Mon, 25 Jun 2007 14:08:30 GMT

I'm using ActiveMQ-CPP 2.0.1. In my program, I want to handle exceptions thrown
by a Connection object, through its ExceptionListener, and act differently
depending on the type of exception that occured.

So, I set my implementation of ExceptionListener for the Connection, so that
my implementation of onException(CMSException) method is called whenever an
error occurs. Inside this method, I can get the stack trace, and the message
from the CMSException object. But I cannot get its type (IOException,
IllegalStateException, etc...).

To behave differently depending on the Exception type, I tried the following :

- Implementing multiple ExceptionListener#onException taking different types of
exceptions doesn't work.
- Throwing the exception and catching again is not possible, since CMSException
is abstract.
- Using typeid() to find the type requires RTTI to be enabled. Using typeid does
not seems to be a good design, and it is not recommended in the company I work.
- Parsing the error message is a last ressort.

Is there another solution I missed ?

View raw message