@Produces @Singleton @Requires(classes={javax.validation.ConstraintViolationException.class,ExceptionHandler.class}) public class ConstraintExceptionHandler extends Object implements ExceptionHandler<ConstraintViolationException,HttpResponse<?>>
ExceptionHandler
for ConstraintViolationException
.Constructor and Description |
---|
ConstraintExceptionHandler(ErrorResponseProcessor<?> responseProcessor)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected String |
buildMessage(ConstraintViolation violation)
Builds a message based on the provided violation.
|
HttpResponse<?> |
handle(HttpRequest request,
ConstraintViolationException exception)
Handles an exception and returns the result.
|
@Inject public ConstraintExceptionHandler(ErrorResponseProcessor<?> responseProcessor)
responseProcessor
- Error Response Processorpublic HttpResponse<?> handle(HttpRequest request, ConstraintViolationException exception)
ExceptionHandler
handle
in interface ExceptionHandler<ConstraintViolationException,HttpResponse<?>>
request
- The requestexception
- The exception typeprotected String buildMessage(ConstraintViolation violation)
violation
- The constraint violation