Package com.yahoo.protect
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 Summary
Fields Modifier and Type Field Description protected Throwable
cause
The cause of this error, or null if none is recordedprotected int
code
An error codeprotected String
detailedMessage
The detailed instance message of this error, not always setprotected 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, String message)
ErrorMessage(int code, String message, String detailedMessage)
Create an application specific error message with an application specific codeErrorMessage(int code, String message, String detailedMessage, 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(Object o)
Two error messages are equal if they have the same code and message.Throwable
getCause()
Returns the cause of this, or null if none is setint
getCode()
String
getDetailedMessage()
Returns the detailed message, or null if there is no detailed messageString
getMessage()
int
hashCode()
void
setCause(Throwable cause)
Sets the cause of this.String
toString()
-
-
-
Field Detail
-
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 Detail
-
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
-
-
Method Detail
-
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
-
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.
-
-