Thanks Claus...I can find many ways around it, I was just wondering if
there was something I was missing or doing wrong...What you are saying
makes sense and I don't think we need to add that at this point.


On Tue, Aug 20, 2013 at 10:59 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5737601...@n5.nabble.com> wrote:

> 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 <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5737601&i=0>>
> 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: [hidden email]<http://user/SendEmail.jtp?type=node&node=5737601&i=1>
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737601.html
>  To unsubscribe from Getting a Header property on a exception in the DSL, 
> click
> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5737551&code=YWJkaWVsc0BnbWFpbC5jb218NTczNzU1MXwtNjU1OTY1MDc=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737611.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to