You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Christian Müller <ch...@gmail.com> on 2013/01/13 17:30:59 UTC

org.apache.camel.InvalidPayloadException

org.apache.camel.InvalidPayloadException is marked a deprecated with the
java doc comment:
"will be removed in Camel 3.0"

There is no hint what the user should use instead. So I'm asking what is
the right replacement? The more generic parent CamelExchangeException?

Best,
Christian

--

Re: org.apache.camel.InvalidPayloadException

Posted by Raul Kripalani <ra...@evosent.com>.
It would be nice to keep this exception class around for endpoints to
reject invalid messages.

There was an old ticket about components advertising their supported
payload types. This exception class could belong within that context.

Regards,
Raúl.
On 13 Jan 2013 21:13, "Babak Vahdat" <ba...@swissonline.ch> wrote:

> Hi
>
> I think the idea is to reuse the Exceptions declared by the TypeConverter
> API like TypeConversionException, NoTypeConversionAvailableException. And
> while reading the InvalidPayloadException JavaDoc itself it's purpose says
> exactly what we've got already through the TypeConverter API meaning this
> exception is obsolete.
>
> As an example we've got the following method signature on
> org.apache.camel.Message:
>
>    <T> T getMandatoryBody(Class<T> type) throws InvalidPayloadException;
>
> Which I think in Camel 3.0 will be changed to something like
>
>    <T> T getMandatoryBody(Class<T> type) throws TypeConversionException,
> NoTypeConversionAvailableException;
>
> Also IMHO the latter exceptions have a really better naming explaining the
> *exact* root cause of the problem e.g. type conversion failed or no type
> conversion was available at all, the former however is a bit obscure as
> there's nothing clear *why* the payload was/is invalid.
>
> Babak
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/org-apache-camel-InvalidPayloadException-tp5725502p5725511.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>

Re: org.apache.camel.InvalidPayloadException

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

I think the idea is to reuse the Exceptions declared by the TypeConverter
API like TypeConversionException, NoTypeConversionAvailableException. And
while reading the InvalidPayloadException JavaDoc itself it's purpose says
exactly what we've got already through the TypeConverter API meaning this
exception is obsolete.

As an example we've got the following method signature on
org.apache.camel.Message:

   <T> T getMandatoryBody(Class<T> type) throws InvalidPayloadException;

Which I think in Camel 3.0 will be changed to something like

   <T> T getMandatoryBody(Class<T> type) throws TypeConversionException,
NoTypeConversionAvailableException;

Also IMHO the latter exceptions have a really better naming explaining the
*exact* root cause of the problem e.g. type conversion failed or no type
conversion was available at all, the former however is a bit obscure as
there's nothing clear *why* the payload was/is invalid.

Babak




--
View this message in context: http://camel.465427.n5.nabble.com/org-apache-camel-InvalidPayloadException-tp5725502p5725511.html
Sent from the Camel Development mailing list archive at Nabble.com.