This is not possible as you use the new constructor in Java that will instantiate the exception once.
What you want is to create a new exception when it happens with data from the message. For that you can call a method and let it throw the exception. For throwException to work with your use case, it would require to not use the new constructor, and let Camel instantiate the exception and evaluate eg any simple expresisons prior etc. eg we could do something alike, throwException(ConfigurationNotFoundException.class, simple("Something got wrong due ${header.bar}")) which then would create the exception using a 1 arg constructor, assuming that would be a String type etc. Though when you need 2+ args then it gets more complicated. Also we should also try to avoid keep expanding the DSL to avoid it growing to large. Though I can see your use-case is probably more common to create an exception with a cause String message that has details from the Camel message. If other feel we need something a like this, then we could raise a JIRA On Tue, Aug 20, 2013 at 2:25 PM, abdiels <abdi...@gmail.com> wrote: > barthorre, > > First, thanks for replying and second, I do that all the time too!!! > However, in this particular it does not work. Look at the code, I am > passing it when throwing the exception, it is not in the regular DSL where > simple will just work. You can try it and you will see. What comes in the > Exception string is: Client Configuration not found for clientid: > ${header.ClientID}. If you try to add simple around it, it does not work > since simple returns a SimpleBuilder so I tried the other code that I showed > on my post, but I am not sure how to get the exchange so I have not been > able to get the value here. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.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