Class ErrorMessage

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class ErrorMessage
    extends java.lang.Object
    implements java.lang.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 Summary

      Constructors 
      Constructor Description
      ErrorMessage​(int code, java.lang.String message)
      Creates an error
      ErrorMessage​(int code, java.lang.String message, java.lang.String details)
      Creates an error
      ErrorMessage​(int code, java.lang.String message, java.lang.String details, java.lang.Throwable cause)
      Creates an error
      ErrorMessage​(int code, java.lang.String message, java.lang.Throwable cause)
      Creates an error
      ErrorMessage​(java.lang.String message)
      Creates an error
      ErrorMessage​(java.lang.String message, java.lang.String details)
      Creates an error
      ErrorMessage​(java.lang.String message, java.lang.String details, java.lang.Throwable cause)
      Creates an error
      ErrorMessage​(java.lang.String message, java.lang.Throwable cause)
      Creates an error
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ErrorMessage clone()  
      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 throwable associated with this error, or null if none
      int getCode()
      Returns the code of this message, or 0 if no code is set
      java.lang.String getDetailedMessage()
      Returns detailed information about this error, or null if there is no detailed message
      java.lang.String getMessage()
      Returns the error message, never null
      int hashCode()  
      java.lang.String toString()
      Returns a formatted message containing the information in this
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ErrorMessage

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

        public ErrorMessage​(int code,
                            java.lang.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​(java.lang.String message,
                            java.lang.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,
                            java.lang.String message,
                            java.lang.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​(java.lang.String message,
                            java.lang.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,
                            java.lang.String message,
                            java.lang.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​(java.lang.String message,
                            java.lang.String details,
                            java.lang.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,
                            java.lang.String message,
                            java.lang.String details,
                            java.lang.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 Detail

      • getCode

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

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

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

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

        public java.lang.String toString()
        Returns a formatted message containing the information in this
        Overrides:
        toString in class java.lang.Object
      • 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
      • clone

        public ErrorMessage clone()
        Overrides:
        clone in class java.lang.Object