Module utility.exception.mapper
Class DataIntegrityViolationExceptionMapper
java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.DataIntegrityViolationExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DataIntegrityViolationException>
@Provider
public class DataIntegrityViolationExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DataIntegrityViolationException>
Maps
DataIntegrityViolationException instances to HTTP 500 responses.
This mapper is typically used for persistence-layer integrity failures that do not have a more specific client-facing representation.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a mapper for data-integrity violations. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.DataIntegrityViolationException ex) Converts the supplied data-integrity exception into an HTTP response.
-
Constructor Details
-
DataIntegrityViolationExceptionMapper
public DataIntegrityViolationExceptionMapper()Creates a mapper for data-integrity violations.
-
-
Method Details
-
toResponse
public jakarta.ws.rs.core.Response toResponse(uk.co.jasonmarston.kiunzi.utility.domain.exception.DataIntegrityViolationException ex) Converts the supplied data-integrity exception into an HTTP response.- Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.domain.exception.DataIntegrityViolationException>- Parameters:
ex- the data-integrity exception raised while processing the request- Returns:
- an HTTP 500 response containing an
ErrorResponsebody
-