Class ConstraintExceptionHandler
- java.lang.Object
-
- io.micronaut.validation.exceptions.ConstraintExceptionHandler
-
- All Implemented Interfaces:
io.micronaut.http.server.exceptions.ExceptionHandler<javax.validation.ConstraintViolationException,io.micronaut.http.HttpResponse<?>>
@Produces @Singleton @Requires(classes={javax.validation.ConstraintViolationException.class,io.micronaut.http.server.exceptions.ExceptionHandler.class}) public class ConstraintExceptionHandler extends java.lang.Object implements io.micronaut.http.server.exceptions.ExceptionHandler<javax.validation.ConstraintViolationException,io.micronaut.http.HttpResponse<?>>
DefaultExceptionHandler
forConstraintViolationException
.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description ConstraintExceptionHandler(io.micronaut.http.server.exceptions.response.ErrorResponseProcessor<?> responseProcessor)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
buildMessage(javax.validation.ConstraintViolation violation)
Builds a message based on the provided violation.io.micronaut.http.HttpResponse<?>
handle(io.micronaut.http.HttpRequest request, javax.validation.ConstraintViolationException exception)
-
-
-
Method Detail
-
handle
public io.micronaut.http.HttpResponse<?> handle(io.micronaut.http.HttpRequest request, javax.validation.ConstraintViolationException exception)
- Specified by:
handle
in interfaceio.micronaut.http.server.exceptions.ExceptionHandler<javax.validation.ConstraintViolationException,io.micronaut.http.HttpResponse<?>>
-
buildMessage
protected java.lang.String buildMessage(javax.validation.ConstraintViolation violation)
Builds a message based on the provided violation.- Parameters:
violation
- The constraint violation- Returns:
- The violation message
-
-