Class ValidationErrorResponseEnricher
- java.lang.Object
-
- org.hawaiiframework.web.exception.ValidationErrorResponseEnricher
-
- All Implemented Interfaces:
ErrorResponseEnricher
public class ValidationErrorResponseEnricher extends Object implements ErrorResponseEnricher
This enricher adds validation errors to the error response resource.- Since:
- 2.0.0
- Author:
- Paul Klos, Richard den Adel
-
-
Constructor Summary
Constructors Constructor Description ValidationErrorResponseEnricher(ModelConverter<ValidationError,ValidationErrorResource> validationErrorResourceAssembler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doEnrich(ErrorResponseResource errorResponseResource, Throwable throwable, org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus httpStatus)
Performs the enrichment of the error response resource.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hawaiiframework.web.exception.ErrorResponseEnricher
enrich
-
-
-
-
Constructor Detail
-
ValidationErrorResponseEnricher
public ValidationErrorResponseEnricher(ModelConverter<ValidationError,ValidationErrorResource> validationErrorResourceAssembler)
-
-
Method Detail
-
doEnrich
public void doEnrich(ErrorResponseResource errorResponseResource, Throwable throwable, org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus httpStatus)
Performs the enrichment of the error response resource. Note that the http status is a given, it is assumed to be determined in the exception handler.NOTE: This enricher only applies if throwable is a
ValidationException
and #errorResponseResource is aValidationErrorResponseResource
.- Specified by:
doEnrich
in interfaceErrorResponseEnricher
- Parameters:
errorResponseResource
- the error response resourcethrowable
- the exception that was raisedrequest
- the original web requesthttpStatus
- the http status that will be returned
-
-