Class DefaultErrorAttributes
java.lang.Object
org.springframework.boot.webflux.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 validation errors derived from a
BindingResultorMethodValidationResultexception (if configured). To ensure safe serialization to JSON, errors arewrapped if necessary - 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:
- 4.0.0
- Author:
- Brian Clozel, Stephane Nicoll, Michele Mancioppi, Scott Frederick, Moritz Halbritter, Yanming Zhou, Yongjun Hong
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetError(ServerRequest request) Return the underlying cause of the error ornullif the error cannot be extracted.getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) Return aMapof the error attributes.voidstoreErrorInformation(Throwable error, ServerWebExchange exchange) Store the given error information in the currentServerWebExchange.
-
Constructor Details
-
DefaultErrorAttributes
public DefaultErrorAttributes()
-
-
Method Details
-
getErrorAttributes
public Map<String, @Nullable Object> getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) Description copied from interface:ErrorAttributesReturn aMapof the error attributes. The map can be used as the model of an error page, or returned as aServerResponsebody.- Specified by:
getErrorAttributesin interfaceErrorAttributes- Parameters:
request- the source requestoptions- options for error attribute contents- Returns:
- a map of error attributes
-
getError
Description copied from interface:ErrorAttributesReturn the underlying cause of the error ornullif the error cannot be extracted.- Specified by:
getErrorin interfaceErrorAttributes- Parameters:
request- the source ServerRequest- Returns:
- the
Exceptionthat caused the error ornull
-
storeErrorInformation
Description copied from interface:ErrorAttributesStore the given error information in the currentServerWebExchange.- Specified by:
storeErrorInformationin interfaceErrorAttributes- Parameters:
error- theExceptionthat caused the errorexchange- the source exchange
-