Interface ErrorAttributes

All Known Implementing Classes:
DefaultErrorAttributes

public interface ErrorAttributes
Provides access to error attributes which can be logged or presented to the user.
Since:
2.0.0
Author:
Brian Clozel, Scott Frederick
See Also:
  • Field Details

    • ERROR_ATTRIBUTE

      static final String ERROR_ATTRIBUTE
      Name of the request attribute holding the error resolved by the ErrorAttributes implementation.
      Since:
      2.5.0
  • Method Details

    • getErrorAttributes

      default Map<String,Object> getErrorAttributes(ServerRequest request, ErrorAttributeOptions options)
      Return a Map of the error attributes. The map can be used as the model of an error page, or returned as a ServerResponse body.
      Parameters:
      request - the source request
      options - options for error attribute contents
      Returns:
      a map of error attributes
    • getError

      Throwable getError(ServerRequest request)
      Return the underlying cause of the error or null if the error cannot be extracted.
      Parameters:
      request - the source ServerRequest
      Returns:
      the Exception that caused the error or null
    • storeErrorInformation

      void storeErrorInformation(Throwable error, ServerWebExchange exchange)
      Store the given error information in the current ServerWebExchange.
      Parameters:
      error - the Exception that caused the error
      exchange - the source exchange