You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Vadim Chekan <vc...@cox.net> on 2008/07/30 09:53:47 UTC
Exception handling in endpoint
Fragment from xmpp code:
XmppExchange exchange = endpoint.createExchange(message);
try {
getProcessor().process(exchange);
} catch (Exception e) {
// TODO: what should we do when a processing failure occurs??
e.printStackTrace();
}
Question: isn't hiding exceptions the worst possible option?
I would expect camel core to handle exceptions properly so that
endpoints do not have to deal with it. Am I right?
Vadim.
RE: Exception handling in endpoint
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Vadim
Yes this is a bad example. I do think the author was trapped with the fact that the PacketListener interface doesn't allow throwing checked exceptions.
What you should do is wrap it in a RuntimeExchangeException.
Camel-core will and should handle the exception, if the component itself can not deal with it (and this is the case in most situations).
Great that you are working on the patches and thus can improve and fix this component in Camel. Always good with new eyes ;)
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Vadim Chekan [mailto:vchekan@cox.net]
Sent: 30. juli 2008 09:54
To: camel-dev@activemq.apache.org
Subject: Exception handling in endpoint
Fragment from xmpp code:
XmppExchange exchange = endpoint.createExchange(message);
try {
getProcessor().process(exchange);
} catch (Exception e) {
// TODO: what should we do when a processing failure occurs??
e.printStackTrace();
}
Question: isn't hiding exceptions the worst possible option?
I would expect camel core to handle exceptions properly so that
endpoints do not have to deal with it. Am I right?
Vadim.