Module utility.exception.mapper
Class DomainExceptionMapper
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
ConstructorsConstructorDescriptionCreates a mapper for unclassified domain exceptions. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.DomainException ex) Converts the supplied domain exception into an HTTP response.
-
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:
toResponsein interfacejakarta.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
ErrorResponsebody
-