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 Details

    • ThrowableExceptionMapper

      public ThrowableExceptionMapper()
      Creates the fallback mapper for otherwise-unhandled throwables.
  • Method Details

    • toResponse

      public jakarta.ws.rs.core.Response toResponse(Throwable ex)
      Converts the supplied throwable into an HTTP response.
      Specified by:
      toResponse in interface jakarta.ws.rs.ext.ExceptionMapper<Throwable>
      Parameters:
      ex - the unexpected throwable raised while processing the request
      Returns:
      an HTTP 500 response containing an ErrorResponse body