Class ServiceException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ReplyTimeoutException

public class ServiceException extends ServerException
Signals that a service request error of some kind has occurred.
See Also:
  • Constructor Details

    • ServiceException

      public ServiceException()
      Constructs a new ServiceException instance. The user message is initialized to null, and the error code is initialized to zero (0).
    • ServiceException

      public ServiceException(String message)
      Constructs a new ServiceException with a message. The user message is initialized to null, and the error code is initialized to zero (0).
      Parameters:
      message - the error message.
    • ServiceException

      public ServiceException(Throwable cause)
      Constructs a new ServiceException with a cause. The user message is initialized to null, and the error code is initialized to zero (0).
      Parameters:
      cause - the cause of the exception.
    • ServiceException

      public ServiceException(String message, Throwable cause)
      Constructs a new ServiceException with a message and cause. The user message is initialized to null, and the error code is initialized to zero (0).
      Parameters:
      message - the error message.
      cause - the cause of the exception.
    • ServiceException

      public ServiceException(int errorCode)
      Constructs a new ServiceException with an error code. The user message is initialized to null. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      errorCode - the exception error code.
    • ServiceException

      public ServiceException(String message, int errorCode)
      Constructs a new ServiceException with an error message and error code. The user message is initialized to null. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      message - the error message.
      errorCode - the exception error code.
    • ServiceException

      public ServiceException(int errorCode, Throwable cause)
      Constructs a new ServiceException with an error code and cause. The user message is initialized to null. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      errorCode - the exception error code.
      cause - the cause of the exception.
    • ServiceException

      public ServiceException(String message, int errorCode, Throwable cause)
      Constructs a new ServiceException with an error message, error code and cause. The user message is initialized to null. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      message - the error message.
      errorCode - the exception error code.
      cause - the cause of the exception.
    • ServiceException

      public ServiceException(String message, String userMessage)
      Constructs a new ServiceException with an error and user message. The error code is initialized to zero (0).
      Parameters:
      message - the error message.
      userMessage - the user message.
    • ServiceException

      public ServiceException(String message, String userMessage, Throwable cause)
      Constructs a new ServiceException with an error message, user message and cause. The error code is initialized to zero (0).
      Parameters:
      message - the error message.
      userMessage - the user message.
      cause - the cause of the exception.
    • ServiceException

      public ServiceException(String message, String userMessage, int errorCode)
      Constructs a new ServiceException with an error message, user message and error code. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      message - the error message.
      userMessage - the user message.
      errorCode - the exception error code.
    • ServiceException

      public ServiceException(String message, String userMessage, int errorCode, Throwable cause)
      Constructs a new ServiceException with an error message, user message, error code and cause. Error codes are non-negative, so if errorCode is negative, it's absolute (positive) value is saved.
      Parameters:
      message - the error message.
      userMessage - the user message.
      errorCode - the exception error code.
      cause - the cause of the exception.
  • Method Details

    • getUserMessage

      public String getUserMessage()
      Returns the user message of this ServiceException.
      Returns:
      the user message or null if none specified.
    • getErrorCode

      public int getErrorCode()
      Returns the error code of this ServiceException. Error codes are non-negative, so this method always returns a value greater than or equal to zero (0).
      Returns:
      the error code or zero (0) if none specified.
    • throwOnError

      public static Message throwOnError(Message message)
      Throws a ServiceException if the status of the supplied message is an error. The ServiceException includes the status, text and userMessage of the message. It returns the supplied message if the status is successful.
      Parameters:
      message - the message to be inspected.
      Returns:
      the supplied message if successful.
      Throws:
      ServiceException - if message is null.