Package com.yahoo.protect
Class ErrorMessage
- java.lang.Object
-
- com.yahoo.protect.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 recordedprotected int
code
An error codeprotected java.lang.String
detailedMessage
The detailed instance message of this error, not always setprotected 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 codeErrorMessage(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 setint
getCode()
java.lang.String
getDetailedMessage()
Returns the detailed message, or null if there is no detailed messagejava.lang.String
getMessage()
int
hashCode()
void
setCause(java.lang.Throwable cause)
Sets the cause of this.java.lang.String
toString()
-
-
-
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 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-