Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 19089 invoked from network); 25 Jun 2007 14:09:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jun 2007 14:09:29 -0000 Received: (qmail 85769 invoked by uid 500); 25 Jun 2007 14:09:31 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 85732 invoked by uid 500); 25 Jun 2007 14:09:31 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 85723 invoked by uid 99); 25 Jun 2007 14:09:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jun 2007 07:09:31 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [213.186.37.103] (HELO 25.mail-out.ovh.net) (213.186.37.103) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 25 Jun 2007 07:09:27 -0700 Received: (qmail 30427 invoked by uid 503); 25 Jun 2007 14:09:27 -0000 Received: (QMFILT: 1.0); 25 Jun 2007 14:09:27 -0000 Received: from b7.ovh.net (HELO mail85.ha.ovh.net) (213.186.33.57) by 25.mail-out.ovh.net with SMTP; 25 Jun 2007 14:09:27 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 25 Jun 2007 14:08:30 -0000 Received: from AMontsouris-152-1-10-170.w82-123.abo.wanadoo.fr (AMontsouris-152-1-10-170.w82-123.abo.wanadoo.fr [82.123.87.170]) by ssl0.ovh.net (IMP) with HTTP for ; Mon, 25 Jun 2007 16:08:30 +0200 Message-ID: <1182780510.467fcc5ee6cef@ssl0.ovh.net> Date: Mon, 25 Jun 2007 16:08:30 +0200 From: olivier.renaud@cantor.fr To: users@activemq.apache.org Subject: making ExceptionListener#onException behave based on Exception type MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Originating-IP: 82.123.87.170 X-Virus-Checked: Checked by ClamAV on apache.org Hello 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 ?