Package io.micronaut.problem.violations
Class ProblemConstraintViolationExceptionHandler
java.lang.Object
io.micronaut.problem.violations.ProblemConstraintViolationExceptionHandler
- All Implemented Interfaces:
io.micronaut.http.server.exceptions.ExceptionHandler<jakarta.validation.ConstraintViolationException,
io.micronaut.http.HttpResponse<?>>
@Produces
@Singleton
@Requires(classes={jakarta.validation.ConstraintViolationException.class,io.micronaut.http.server.exceptions.ExceptionHandler.class})
@Replaces(io.micronaut.validation.exceptions.ConstraintExceptionHandler.class)
public class ProblemConstraintViolationExceptionHandler
extends Object
implements io.micronaut.http.server.exceptions.ExceptionHandler<jakarta.validation.ConstraintViolationException,io.micronaut.http.HttpResponse<?>>
- Since:
- 1.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionProblemConstraintViolationExceptionHandler
(io.micronaut.http.server.exceptions.response.ErrorResponseProcessor<?> responseProcessor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull Violation
createViolation
(@NonNull jakarta.validation.ConstraintViolation<?> constraintViolation) io.micronaut.http.HttpResponse<?>
handle
(io.micronaut.http.HttpRequest request, jakarta.validation.ConstraintViolationException exception)
-
Constructor Details
-
ProblemConstraintViolationExceptionHandler
public ProblemConstraintViolationExceptionHandler(io.micronaut.http.server.exceptions.response.ErrorResponseProcessor<?> responseProcessor) Constructor.- Parameters:
responseProcessor
- Error Response Processor
-
-
Method Details
-
handle
public io.micronaut.http.HttpResponse<?> handle(io.micronaut.http.HttpRequest request, jakarta.validation.ConstraintViolationException exception) - Specified by:
handle
in interfaceio.micronaut.http.server.exceptions.ExceptionHandler<jakarta.validation.ConstraintViolationException,
io.micronaut.http.HttpResponse<?>>
-
createViolation
@NonNull protected @NonNull Violation createViolation(@NonNull @NonNull jakarta.validation.ConstraintViolation<?> constraintViolation) - Parameters:
constraintViolation
- Constraint Violation- Returns:
- A Violation
-