Class Error

java.lang.Object
com.yahoo.messagebus.Error

public final class Error extends 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, String message)
    This is the constructor used by anyone adding an error to a message.
    Error(int code, String message, 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

    Modifier and Type
    Method
    Description
    int
    Return the numerical code of this error.
    Return the description of this error.
    Returns the name of the service on which this error occured.
    boolean
    Returns whether or not this error is fatal, i.e.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Error

      public Error(int code, 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, String message, 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 Details

    • getCode

      public int getCode()
      Return the numerical code of this error.
      Returns:
      The numerical code.
    • getMessage

      public String getMessage()
      Return the description of this error.
      Returns:
      The description.
    • getService

      public 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 String toString()
      Overrides:
      toString in class Object