java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.DomainExceptionMapper
All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException>

@Provider public class DomainExceptionMapper extends Object implements jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException>
Maps unclassified DomainException instances to HTTP 500 responses.

This mapper provides a fallback transport representation for domain-level failures that are not handled by a more specific exception mapper.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a mapper for unclassified domain exceptions.
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException ex)
    Converts the supplied domain exception into an HTTP response.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DomainExceptionMapper

      public DomainExceptionMapper()
      Creates a mapper for unclassified domain exceptions.
  • Method Details

    • toResponse

      public jakarta.ws.rs.core.Response toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException ex)
      Converts the supplied domain exception into an HTTP response.
      Specified by:
      toResponse in interface jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException>
      Parameters:
      ex - the domain exception raised while processing the request
      Returns:
      an HTTP 500 response containing an ErrorResponse body