Re: REST DSL Exception Handling

2014-12-15 Thread restful camel
This is when the Json request comes in to the webservice. I am deliberately
sending in a malformed Json object, just so that I can handle it - our
service will be called by various applications, and I want to be able to
send a response back to the caller with the message that the Json is
malformed.

I tried setting the bridgeErrorHandler property, but it does not help. See
below for the configuration in Spring:

restConfiguration bindingMode=auto component=restlet 
port=8085
consumerProperty key=bridgeErrorHandler 
value=true/
/restConfiguration




--
View this message in context: 
http://camel.465427.n5.nabble.com/REST-DSL-Exception-Handling-tp5760600p5760714.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: REST DSL Exception Handling

2014-12-15 Thread Claus Ibsen
Hi

Thanks for trying. I logged a ticket to support this in next release
https://issues.apache.org/jira/browse/CAMEL-8155

On Mon, Dec 15, 2014 at 8:01 PM, restful camel bin...@gmail.com wrote:
 This is when the Json request comes in to the webservice. I am deliberately
 sending in a malformed Json object, just so that I can handle it - our
 service will be called by various applications, and I want to be able to
 send a response back to the caller with the message that the Json is
 malformed.

 I tried setting the bridgeErrorHandler property, but it does not help. See
 below for the configuration in Spring:

 restConfiguration bindingMode=auto component=restlet 
 port=8085
 consumerProperty key=bridgeErrorHandler 
 value=true/
 /restConfiguration




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/REST-DSL-Exception-Handling-tp5760600p5760714.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


REST DSL Exception Handling

2014-12-12 Thread restful camel
Hi,

Newbie to Camel. I want to handle a specific exception (JsonParseException)
which is thrown when the Rest webservice configured in the camelContext
(Spring DSL) is invoked. Right now, the JsonParseException is being caught
by the Camel Context Error handler - however, I want to be able to write a
specific onException block that will handle this exception and send back
appropriate response to the user. How can I achieve this? I tried writing an
onException block in the camelContext to handle this, but apparently the
thrown exception is not being handled within that block.

Thanks!
Restful Camel :)



--
View this message in context: 
http://camel.465427.n5.nabble.com/REST-DSL-Exception-Handling-tp5760600.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: REST DSL Exception Handling

2014-12-12 Thread Claus Ibsen
Hi

Where does this exception happen?

You can try setting consumer.bridgeErrorHandler=true
http://camel.apache.org/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.html

You would need to set this with rest-dsl as a consumer property
http://camel.apache.org/rest-dsl

restConfiguration().component(jetty).port(9091).consumerProperty(bridgeErrorHandler,
true);

On Thu, Dec 11, 2014 at 10:19 PM, restful camel bin...@gmail.com wrote:
 Hi,

 Newbie to Camel. I want to handle a specific exception (JsonParseException)
 which is thrown when the Rest webservice configured in the camelContext
 (Spring DSL) is invoked. Right now, the JsonParseException is being caught
 by the Camel Context Error handler - however, I want to be able to write a
 specific onException block that will handle this exception and send back
 appropriate response to the user. How can I achieve this? I tried writing an
 onException block in the camelContext to handle this, but apparently the
 thrown exception is not being handled within that block.

 Thanks!
 Restful Camel :)



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/REST-DSL-Exception-Handling-tp5760600.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/