Class ErrorMessage

java.lang.Object
com.yahoo.protect.ErrorMessage

public class ErrorMessage extends Object
An error message with a code. This class should be treated as immutable.
Author:
bratseth
  • Field Details

    • code

      protected int code
      An error code
    • message

      protected String message
      The short message of this error, always set
    • detailedMessage

      protected String detailedMessage
      The detailed instance message of this error, not always set
    • cause

      protected Throwable cause
      The cause of this error, or null if none is recorded
  • Constructor Details

    • ErrorMessage

      public ErrorMessage()
      Create an invalid instance for a subclass to initialize.
    • ErrorMessage

      public ErrorMessage(int code, String message)
    • ErrorMessage

      public ErrorMessage(int code, String message, String detailedMessage)
      Create an application specific error message with an application specific code
    • ErrorMessage

      public ErrorMessage(int code, String message, String detailedMessage, Throwable cause)
      Create an application specific error message with an application specific code
  • Method Details

    • getCode

      public int getCode()
    • getMessage

      public String getMessage()
    • getDetailedMessage

      public String getDetailedMessage()
      Returns the detailed message, or null if there is no detailed message
    • setCause

      public void setCause(Throwable cause)
      Sets the cause of this. This should be set on errors which likely have their origin in plugin component code, not on others.
    • getCause

      public Throwable getCause()
      Returns the cause of this, or null if none is set
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object