I have a quarkus AWS lambda handler
public class Handler implements RequestHandler<RequestDto, ResponseDto> {
@Override
public ResponseDto handleRequest(final RequestDto request, final Context context) {
...
//here for example a custom exception is thrown
throw new CustomException("some error message");
...
}
}
I have also an exception mapper for CustomException
@Provider
@RegisterForReflection
public class CustomExceptionMapper implements ExceptionMapper<CustomException> {
@Override
public Response toResponse(CustomException ex) {
var response = ...;
return Response.status(HttpStatus.SC_OK).entity(response).build();
}
The issue is that the CustomExceptionMapper is not called when the AWS hadnler is called an exception is thrown.
How to resolve this?
Tries annotations @Provider @RegisterForReflection