Class ErrorMessage

java.lang.Object
com.yahoo.processing.request.ErrorMessage
All Implemented Interfaces:
Cloneable

public class ErrorMessage extends Object implements Cloneable
An error encountered while processing a request. This can be subclassed to add error messages containing more information.

Error messages are immutable.

Author:
bratseth
  • Constructor Details

    • ErrorMessage

      public ErrorMessage(String message)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
    • ErrorMessage

      public ErrorMessage(int code, String message)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
      code - an error code. If this is bound to HTTP request/responses and this error code is a HTTP status code, this code will be returned as the HTTP status
    • ErrorMessage

      public ErrorMessage(String message, String details)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
      details - a longer detail description of this condition
    • ErrorMessage

      public ErrorMessage(int code, String message, String details)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
      code - an error code. If this is bound to HTTP request/responses and this error code is a HTTP status code, this code will be returned as the HTTP status
      details - a longer detail description of this condition
    • ErrorMessage

      public ErrorMessage(String message, Throwable cause)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
      cause - the cause of this error
    • ErrorMessage

      public ErrorMessage(int code, String message, Throwable cause)
      Creates an error
      Parameters:
      code - an error code. If this is bound to HTTP request/responses and this error code is a HTTP status code, this code will be returned as the HTTP status
      message - the textual message describing this condition tersely
      cause - the cause of this error
    • ErrorMessage

      public ErrorMessage(String message, String details, Throwable cause)
      Creates an error
      Parameters:
      message - the textual message describing this condition tersely
      details - a longer detail description of this condition
      cause - the cause of this error
    • ErrorMessage

      public ErrorMessage(int code, String message, String details, Throwable cause)
      Creates an error
      Parameters:
      code - an error code. If this is bound to HTTP request/responses and this error code is a HTTP status code, this code will be returned as the HTTP status
      message - the textual message describing this condition tersely
      details - a longer detail description of this condition
      cause - the cause of this error
  • Method Details

    • getCode

      public int getCode()
      Returns the code of this message, or 0 if no code is set
    • getMessage

      public String getMessage()
      Returns the error message, never null
    • getDetailedMessage

      public String getDetailedMessage()
      Returns detailed information about this error, or null if there is no detailed message
    • getCause

      public Throwable getCause()
      Returns the throwable associated with this error, or null if none
    • toString

      public String toString()
      Returns a formatted message containing the information in this
      Overrides:
      toString in class Object
    • hashCode

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

      public boolean equals(Object o)
      Two error messages are equal if they have the same code and message. The cause is ignored in the comparison.
      Overrides:
      equals in class Object
    • clone

      public ErrorMessage clone()
      Overrides:
      clone in class Object