In the header, exceptions thrown from ParamConverter are NOT handled as I expect.
With ExceptionMapper:
@Provider public class MyExceptionMapper implements ExceptionMapper<MyException> { @Override public Response toResponse(MyException exception) { return Response.serverError().entity( "It triggered" ).build(); } }
and ParamConverter:
@Provider (boilerplate junk) @Override public DateTime fromString(String value) { throw new MyException("convert"); }
It does not return the text "This is called" in error 500, but rather 404.
Expected question: are both providers registered?
Yes. If I throw a "MyException" from the resource (in the "regular" code), it works as expected. I can also convert seetrace with the message "convert".
Is there a way to make exceptions from ParamConverters by handling ExceptionMapper?
I am using jersey 2.3.1 with spring-jersey running in container for berth 9.1.0.RC0
cmonkey
source share