Package com.yahoo.processing.request
Class ErrorMessage
- java.lang.Object
-
- com.yahoo.processing.request.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 errorErrorMessage(int code, java.lang.String message, java.lang.String details)
Creates an errorErrorMessage(int code, java.lang.String message, java.lang.String details, java.lang.Throwable cause)
Creates an errorErrorMessage(int code, java.lang.String message, java.lang.Throwable cause)
Creates an errorErrorMessage(java.lang.String message)
Creates an errorErrorMessage(java.lang.String message, java.lang.String details)
Creates an errorErrorMessage(java.lang.String message, java.lang.String details, java.lang.Throwable cause)
Creates an errorErrorMessage(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 noneint
getCode()
Returns the code of this message, or 0 if no code is setjava.lang.String
getDetailedMessage()
Returns detailed information about this error, or null if there is no detailed messagejava.lang.String
getMessage()
Returns the error message, never nullint
hashCode()
java.lang.String
toString()
Returns a formatted message containing the information in this
-
-
-
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 terselycode
- 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 terselydetails
- 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 terselycode
- 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 statusdetails
- 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 terselycause
- 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 statusmessage
- the textual message describing this condition terselycause
- 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 terselydetails
- a longer detail description of this conditioncause
- 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 statusmessage
- the textual message describing this condition terselydetails
- a longer detail description of this conditioncause
- 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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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 classjava.lang.Object
-
clone
public ErrorMessage clone()
- Overrides:
clone
in classjava.lang.Object
-
-