users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: ExceptionMappers and WebApplicationExceptions

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 25 Oct 2012 22:17:49 +0100

On 25/10/12 22:10, Marek Potociar wrote:
>
> On Oct 25, 2012, at 10:57 PM, Sergey Beryozkin<sberyozkin_at_talend.com> wrote:
>
>> Hi
>>
>> I would like to clarify the details of the way WebApplicationExceptions are mapped on the server.
>>
>> Here is what I recall we talked about the other day.
>>
>> The code throws "new WebApplicationException(404)", and both WebApplicationException and NotFoundException mappers are available.
>>
>> Given NotFoundException is effectively WebApplicationException(404),
>> NotFoundException mapper is chosen.
>
> Hmm... are you referring to a specific section in the spec? I cannot recall we agreed on that one, but I may be wrong.
>
>>
>> Similarly, if the code throws "new ServerErrorException(500)" and both
>> ServerErrorException and InternalServerErrorException mappers are available, InternalServerErrorException gets chosen.
>>
>> Is it the way it should work ? This obviously is an exception to the default mapping algorithm, but it appears it is logical given that the runtime understands the relationship between various API exception classes
>
> As I said, I don't recall such agreement, but my memory is not flawless... If you see it in the spec, then we did agree on that :) (Which still doesn't mean we didn't if you don't see it there...)

I only recall you asking what should we do in such cases, and I kind of
suggesting the above. I've no problems with not pursuing it, but I
wonder what the user expectations can be in such cases

Cheers, Sergey

>
> Marek
>
>>
>> Cheers. Sergey
>