Package com.yahoo.messagebus
Class Error
- java.lang.Object
-
- com.yahoo.messagebus.Error
-
public final class Error extends java.lang.Object
This class implements the pair (code, message) that is used in Reply to hold errors.- Author:
- Simon Thoresen Hult
-
-
Constructor Summary
Constructors Constructor Description Error(int code, java.lang.String message)
This is the constructor used by anyone adding an error to a message.Error(int code, java.lang.String message, java.lang.String service)
This constructor is used by the network layer to properly tag deserialized errors with the hostname of whatever service produced the error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCode()
Return the numerical code of this error.java.lang.String
getMessage()
Return the description of this error.java.lang.String
getService()
Returns the name of the service on which this error occured.boolean
isFatal()
Returns whether or not this error is fatal, i.e.java.lang.String
toString()
-
-
-
Constructor Detail
-
Error
public Error(int code, java.lang.String message)
This is the constructor used by anyone adding an error to a message. One does not manually need to set the service name of an error, so ignore the other constructor when creating your own error instance.- Parameters:
code
- The numerical code of this error.message
- The description of this error.
-
Error
public Error(int code, java.lang.String message, java.lang.String service)
This constructor is used by the network layer to properly tag deserialized errors with the hostname of whatever service produced the error. This constructor should NOT be used when manually creating errors.- Parameters:
code
- The numerical code of this error.message
- The description of this error.service
- The service name of this error.
-
-
Method Detail
-
getCode
public int getCode()
Return the numerical code of this error.- Returns:
- The numerical code.
-
getMessage
public java.lang.String getMessage()
Return the description of this error.- Returns:
- The description.
-
getService
public java.lang.String getService()
Returns the name of the service on which this error occured.- Returns:
- The service name.
-
isFatal
public boolean isFatal()
Returns whether or not this error is fatal, i.e. getCode() >= ErrorCode.FATAL_ERROR.- Returns:
- True, if this error is fatal.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-