org.springframework.boot.web.reactive.error

Class DefaultErrorAttributes

  • java.lang.Object
    • org.springframework.boot.web.reactive.error.DefaultErrorAttributes
  • All Implemented Interfaces:
    ErrorAttributes


    public class DefaultErrorAttributes
    extends java.lang.Object
    implements ErrorAttributes
    Default implementation of ErrorAttributes. Provides the following attributes when possible:
    • timestamp - The time that the errors were extracted
    • status - The status code
    • error - The error reason
    • exception - The class name of the root exception (if configured)
    • message - The exception message (if configured)
    • errors - Any ObjectErrors from a BindingResult exception (if configured)
    • trace - The exception stack trace (if configured)
    • path - The URL path when the exception was raised
    • requestId - Unique ID associated with the current request
    Since:
    2.0.0
    See Also:
    ErrorAttributes
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Throwable getError(org.springframework.web.reactive.function.server.ServerRequest request)
      Return the underlying cause of the error or null if the error cannot be extracted.
      java.util.Map<java.lang.String,java.lang.Object> getErrorAttributes(org.springframework.web.reactive.function.server.ServerRequest request, ErrorAttributeOptions options)
      Return a Map of the error attributes.
      void storeErrorInformation(java.lang.Throwable error, org.springframework.web.server.ServerWebExchange exchange)
      Store the given error information in the current ServerWebExchange.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultErrorAttributes

        public DefaultErrorAttributes()
    • Method Detail

      • getErrorAttributes

        public java.util.Map<java.lang.String,java.lang.Object> getErrorAttributes(org.springframework.web.reactive.function.server.ServerRequest request,
                                                                                   ErrorAttributeOptions options)
        Description copied from interface: ErrorAttributes
        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.
        Specified by:
        getErrorAttributes in interface ErrorAttributes
        Parameters:
        request - the source request
        options - options for error attribute contents
        Returns:
        a map of error attributes
      • getError

        public java.lang.Throwable getError(org.springframework.web.reactive.function.server.ServerRequest request)
        Description copied from interface: ErrorAttributes
        Return the underlying cause of the error or null if the error cannot be extracted.
        Specified by:
        getError in interface ErrorAttributes
        Parameters:
        request - the source ServerRequest
        Returns:
        the Exception that caused the error or null
      • storeErrorInformation

        public void storeErrorInformation(java.lang.Throwable error,
                                          org.springframework.web.server.ServerWebExchange exchange)
        Description copied from interface: ErrorAttributes
        Store the given error information in the current ServerWebExchange.
        Specified by:
        storeErrorInformation in interface ErrorAttributes
        Parameters:
        error - the Exception that caused the error
        exchange - the source exchange