Module utility.exception.mapper
Class ThrowableExceptionMapper
java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.ThrowableExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<Throwable>
@Provider
public class ThrowableExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<Throwable>
Fallback exception mapper that converts otherwise-unhandled throwables into HTTP
500 responses.
This mapper provides a final safety net for unexpected failures that escape the more specific application exception mappers.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the fallback mapper for otherwise-unhandled throwables. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(Throwable ex) Converts the supplied throwable into an HTTP response.
-
Constructor Details
-
ThrowableExceptionMapper
public ThrowableExceptionMapper()Creates the fallback mapper for otherwise-unhandled throwables.
-
-
Method Details
-
toResponse
Converts the supplied throwable into an HTTP response.- Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<Throwable>- Parameters:
ex- the unexpected throwable raised while processing the request- Returns:
- an HTTP 500 response containing an
ErrorResponsebody
-