Interface ErrorResponseEnricher

All Known Implementing Classes:
ApiErrorResponseEnricher, ErrorMessageResponseEnricher, ErrorResponseStatusEnricher, MethodArgumentNotValidResponseEnricher, 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. A HawaiiResponseEntityExceptionHandler has a list of ErrorResponseEnrichers, which will make sure that all relevant information is captured in the error response.
Since:
2.0.0
  • Method Summary

    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 calls doEnrich(ErrorResponseResource, Throwable, WebRequest, HttpStatus).
  • Method Details

    • 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 calls doEnrich(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 resource
      request - the original web request
      httpStatus - 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 resource
      throwable - the exception that was raised
      request - the original web request
      httpStatus - the http status that will be returned