Class ErrorMessage


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

      Fields 
      Modifier and Type Field Description
      protected java.lang.Throwable cause
      The cause of this error, or null if none is recorded
      protected int code
      An error code
      protected java.lang.String detailedMessage
      The detailed instance message of this error, not always set
      protected java.lang.String message
      The short message of this error, always set
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrorMessage()
      Create an invalid instance for a subclass to initialize.
      ErrorMessage​(int code, java.lang.String message)  
      ErrorMessage​(int code, java.lang.String message, java.lang.String detailedMessage)
      Create an application specific error message with an application specific code
      ErrorMessage​(int code, java.lang.String message, java.lang.String detailedMessage, java.lang.Throwable cause)
      Create an application specific error message with an application specific code
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Two error messages are equal if they have the same code and message.
      java.lang.Throwable getCause()
      Returns the cause of this, or null if none is set
      int getCode()  
      java.lang.String getDetailedMessage()
      Returns the detailed message, or null if there is no detailed message
      java.lang.String getMessage()  
      int hashCode()  
      void setCause​(java.lang.Throwable cause)
      Sets the cause of this.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • code

        protected int code
        An error code
      • message

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

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

        protected java.lang.Throwable cause
        The cause of this error, or null if none is recorded
    • Constructor Detail

      • ErrorMessage

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

        public ErrorMessage​(int code,
                            java.lang.String message)
      • ErrorMessage

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

        public ErrorMessage​(int code,
                            java.lang.String message,
                            java.lang.String detailedMessage,
                            java.lang.Throwable cause)
        Create an application specific error message with an application specific code
    • Method Detail

      • getCode

        public int getCode()
      • getMessage

        public java.lang.String getMessage()
      • getDetailedMessage

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

        public void setCause​(java.lang.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 java.lang.Throwable getCause()
        Returns the cause of this, or null if none is set
      • hashCode

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

        public boolean equals​(java.lang.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 java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object