Class Error
java.lang.Object
org.springframework.boot.web.error.Error
- All Implemented Interfaces:
MessageSourceResolvable
A wrapper class for
MessageSourceResolvable
errors that is safe for JSON
serialization.- Since:
- 3.5.0
- Author:
- Yongjun Hong, Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Object[]
getCause()
Return the original cause of the error.String[]
getCodes()
int
hashCode()
toString()
wrap
(List<? extends MessageSourceResolvable> errors) Deprecated, for removal: This API element is subject to removal in a future version.static List<MessageSourceResolvable>
wrapIfNecessary
(List<? extends MessageSourceResolvable> errors) Wrap the given errors, if necessary, such that they are suitable for serialization to JSON.
-
Method Details
-
getCodes
- Specified by:
getCodes
in interfaceMessageSourceResolvable
-
getArguments
- Specified by:
getArguments
in interfaceMessageSourceResolvable
-
getDefaultMessage
- Specified by:
getDefaultMessage
in interfaceMessageSourceResolvable
-
getCause
Return the original cause of the error.- Returns:
- the error cause
-
equals
-
hashCode
public int hashCode() -
toString
-
wrap
@Deprecated(since="3.5.4", forRemoval=true) public static List<Error> wrap(List<? extends MessageSourceResolvable> errors) Deprecated, for removal: This API element is subject to removal in a future version.since 3.5.4 for removal in 4.0.0 in favor ofwrapIfNecessary(List)
Wrap the given errors such that they are suitable for serialization to JSON.- Parameters:
errors
- the errors to wrap- Returns:
- a new Error list
-
wrapIfNecessary
public static List<MessageSourceResolvable> wrapIfNecessary(List<? extends MessageSourceResolvable> errors) Wrap the given errors, if necessary, such that they are suitable for serialization to JSON.MessageSourceResolvable
implementations that are known to be suitable are not wrapped.- Parameters:
errors
- the errors to wrap- Returns:
- a new Error list
- Since:
- 3.5.4
-
wrapIfNecessary(List)