I am working on a Quarkus (2.7.1)
application and facing with a problem which I cannot understand the reason.I write a class that implement ExceptionMapper
interface to catch RuntimeException
and I expect that any unhandled exception will be caught in this mapper as this is the only mapper I have in my application.
@Provider
public class BaseRuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
@Override
public Response toResponse(RuntimeException e) {
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build();
}
}
The strange thing is that when I run the application in dev
mode (running from ide), if an exception thrown by JAX-RS (e.g. NotFountExction
) the mapper is not invoked and as a direct result, the exception Response object will return as http response. But the same code works as I expected if I run in production mode (directly run the generated jar). Can anybody give me any clue?
I define an exceptionmapper and I expect that any unhandled exception caught by the mapper. This works properly when the application run on production, but on dev mode the mapper is not invoked.