I am using Jersey in Spring Boot. I have a ExceptionMapper<Throwable>
registered via ResourceConfig.register(MyExceptionMapper.class)
and it is annotated with @Provider
.
If my code throws a RuntimeException
MyExceptionMapper.toResponse()
DOES get called.
However, if my application throws a javax.ws.rs.ForbiddenException
, then my ExceptionMapper
is not called even though it is a ExceptionMapper<Throwable>
.
I am assuming that Jersey has a default ExceptionMapper
that is handing WebApplicationException
(I assume). How can I customize this?
All I really want to do is add DEBUG logging in the case of any Throwable
(rest of code works fine for non-WebApplicationException). Is there a better way to do this?