Class ServiceException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cl.netswitch.lib.server.ServerException
cl.netswitch.lib.server.ServiceException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ReplyTimeoutException
Signals that a service request error of some kind has occurred.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newServiceExceptioninstance.ServiceException(int errorCode) Constructs a newServiceExceptionwith an error code.ServiceException(int errorCode, Throwable cause) Constructs a newServiceExceptionwith an error code and cause.ServiceException(String message) Constructs a newServiceExceptionwith a message.ServiceException(String message, int errorCode) Constructs a newServiceExceptionwith an error message and error code.ServiceException(String message, int errorCode, Throwable cause) Constructs a newServiceExceptionwith an error message, error code and cause.ServiceException(String message, String userMessage) Constructs a newServiceExceptionwith an error and user message.ServiceException(String message, String userMessage, int errorCode) Constructs a newServiceExceptionwith an error message, user message and error code.ServiceException(String message, String userMessage, int errorCode, Throwable cause) Constructs a newServiceExceptionwith an error message, user message, error code and cause.ServiceException(String message, String userMessage, Throwable cause) Constructs a newServiceExceptionwith an error message, user message and cause.ServiceException(String message, Throwable cause) Constructs a newServiceExceptionwith a message and cause.ServiceException(Throwable cause) Constructs a newServiceExceptionwith a cause. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the error code of thisServiceException.Returns the user message of thisServiceException.static MessagethrowOnError(Message message) Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ServiceException
public ServiceException()Constructs a newServiceExceptioninstance. The user message is initialized tonull, and the error code is initialized to zero (0). -
ServiceException
Constructs a newServiceExceptionwith a message. The user message is initialized tonull, and the error code is initialized to zero (0).- Parameters:
message- the error message.
-
ServiceException
Constructs a newServiceExceptionwith a cause. The user message is initialized tonull, and the error code is initialized to zero (0).- Parameters:
cause- the cause of the exception.
-
ServiceException
-
ServiceException
public ServiceException(int errorCode) Constructs a newServiceExceptionwith an error code. The user message is initialized tonull. Error codes are non-negative, so iferrorCodeis negative, it's absolute (positive) value is saved.- Parameters:
errorCode- the exception error code.
-
ServiceException
Constructs a newServiceExceptionwith an error message and error code. The user message is initialized tonull. Error codes are non-negative, so iferrorCodeis negative, it's absolute (positive) value is saved.- Parameters:
message- the error message.errorCode- the exception error code.
-
ServiceException
Constructs a newServiceExceptionwith an error code and cause. The user message is initialized tonull. Error codes are non-negative, so iferrorCodeis negative, it's absolute (positive) value is saved.- Parameters:
errorCode- the exception error code.cause- the cause of the exception.
-
ServiceException
Constructs a newServiceExceptionwith an error message, error code and cause. The user message is initialized tonull. Error codes are non-negative, so iferrorCodeis 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
-
ServiceException
Constructs a newServiceExceptionwith 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
Constructs a newServiceExceptionwith an error message, user message and error code. Error codes are non-negative, so iferrorCodeis negative, it's absolute (positive) value is saved.- Parameters:
message- the error message.userMessage- the user message.errorCode- the exception error code.
-
ServiceException
Constructs a newServiceExceptionwith an error message, user message, error code and cause. Error codes are non-negative, so iferrorCodeis 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
Returns the user message of thisServiceException.- Returns:
- the user message or
nullif none specified.
-
getErrorCode
public int getErrorCode()Returns the error code of thisServiceException. 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
Throws aServiceExceptionif thestatusof the supplied message is anerror. TheServiceExceptionincludes thestatus,textanduserMessageof themessage. It returns the suppliedmessageif the status issuccessful.- Parameters:
message- the message to be inspected.- Returns:
- the supplied
messageif successful. - Throws:
ServiceException- ifmessageisnull.
-