Class Error

java.lang.Object
org.springframework.boot.web.error.Error
All Implemented Interfaces:
org.springframework.context.MessageSourceResolvable

public final class Error extends Object implements org.springframework.context.MessageSourceResolvable
A wrapper class for MessageSourceResolvable errors that is safe for JSON serialization.
Since:
3.5.0
  • Method Details

    • getCodes

      public String[] getCodes()
      Specified by:
      getCodes in interface org.springframework.context.MessageSourceResolvable
    • getArguments

      public Object[] getArguments()
      Specified by:
      getArguments in interface org.springframework.context.MessageSourceResolvable
    • getDefaultMessage

      public String getDefaultMessage()
      Specified by:
      getDefaultMessage in interface org.springframework.context.MessageSourceResolvable
    • getCause

      public org.springframework.context.MessageSourceResolvable getCause()
      Return the original cause of the error.
      Returns:
      the error cause
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • wrap

      @Deprecated(since="3.5.4", forRemoval=true) public static List<Error> wrap(List<? extends org.springframework.context.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 of wrapIfNecessary(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<org.springframework.context.MessageSourceResolvable> wrapIfNecessary(List<? extends org.springframework.context.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