Interface ErrorResponseEnricher
-
- All Known Implementing Classes:
ApiErrorResponseEnricher
,ErrorMessageResponseEnricher
,ErrorResponseStatusEnricher
,RequestInfoErrorResponseEnricher
,ValidationErrorResponseEnricher
public interface ErrorResponseEnricher
This interface defines a way to enrich the error response with values applicable to the given situation. The situation in this case consists of the exception, the original request and the http status. AHawaiiResponseEntityExceptionHandler
has a list of ErrorResponseEnrichers, which will make sure that all relevant information is captured in the error response.- Since:
- 2.0.0
- Author:
- Paul Klos
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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.default void
enrich(ErrorResponseResource errorResponseResource, org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus httpStatus)
Default implementation that first retrieves the original throwable stored in the error response resource, and then callsdoEnrich(ErrorResponseResource, Throwable, WebRequest, HttpStatus)
.
-
-
-
Method Detail
-
enrich
default void enrich(ErrorResponseResource errorResponseResource, org.springframework.web.context.request.WebRequest request, org.springframework.http.HttpStatus httpStatus)
Default implementation that first retrieves the original throwable stored in the error response resource, and then callsdoEnrich(ErrorResponseResource, Throwable, WebRequest, HttpStatus)
. Note that the http status is a given, it is assumed to be determined in the exception handler.- Parameters:
errorResponseResource
- the error response resourcerequest
- the original web requesthttpStatus
- the http status that will be returned
-
doEnrich
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.- Parameters:
errorResponseResource
- the error response resourcethrowable
- the exception that was raisedrequest
- the original web requesthttpStatus
- the http status that will be returned
-
-