Class DefaultErrorAttributes
java.lang.Object
org.springframework.boot.web.reactive.error.DefaultErrorAttributes
- All Implemented Interfaces:
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
ObjectError
s from aBindingResult
orMethodValidationResult
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetError
(org.springframework.web.reactive.function.server.ServerRequest request) Return the underlying cause of the error ornull
if the error cannot be extracted.getErrorAttributes
(org.springframework.web.reactive.function.server.ServerRequest request, ErrorAttributeOptions options) Return aMap
of the error attributes.void
storeErrorInformation
(Throwable error, org.springframework.web.server.ServerWebExchange exchange) Store the given error information in the currentServerWebExchange
.
-
Constructor Details
-
DefaultErrorAttributes
public DefaultErrorAttributes()
-
-
Method Details
-
getErrorAttributes
public Map<String,Object> getErrorAttributes (org.springframework.web.reactive.function.server.ServerRequest request, ErrorAttributeOptions options) Description copied from interface:ErrorAttributes
Return aMap
of the error attributes. The map can be used as the model of an error page, or returned as aServerResponse
body.- Specified by:
getErrorAttributes
in interfaceErrorAttributes
- Parameters:
request
- the source requestoptions
- options for error attribute contents- Returns:
- a map of error attributes
-
getError
Description copied from interface:ErrorAttributes
Return the underlying cause of the error ornull
if the error cannot be extracted.- Specified by:
getError
in interfaceErrorAttributes
- Parameters:
request
- the source ServerRequest- Returns:
- the
Exception
that caused the error ornull
-
storeErrorInformation
public void storeErrorInformation(Throwable error, org.springframework.web.server.ServerWebExchange exchange) Description copied from interface:ErrorAttributes
Store the given error information in the currentServerWebExchange
.- Specified by:
storeErrorInformation
in interfaceErrorAttributes
- Parameters:
error
- theException
that caused the errorexchange
- the source exchange
-