Class ClientException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cl.netswitch.lib.client.ClientException
- All Implemented Interfaces:
Serializable
Signals that a client error of some kind has occurred. This exception is the
superclass of all the other exceptions defined and used in a client.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newClientExceptioninstance.ClientException(int errorCode) Constructs a newClientExceptionwith an error code.ClientException(int errorCode, Throwable cause) Constructs a newClientExceptionwith an error code and cause.ClientException(String message) Constructs a newClientExceptionwith a message.ClientException(String message, int errorCode) Constructs a newClientExceptionwith an error message and error code.ClientException(String message, int errorCode, Throwable cause) Constructs a newClientExceptionwith an error message, error code and cause.ClientException(String message, String userMessage) Constructs a newClientExceptionwith an error and user message.ClientException(String message, String userMessage, int errorCode) Constructs a newClientExceptionwith an error message, user message and error code.ClientException(String message, String userMessage, int errorCode, Throwable cause) Constructs a newClientExceptionwith an error message, user message, error code and cause.ClientException(String message, String userMessage, Throwable cause) Constructs a newClientExceptionwith an error message, user message and cause.ClientException(String message, Throwable cause) Constructs a newClientExceptionwith a message and cause.ClientException(Throwable cause) Constructs a newClientExceptionwith a cause. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the error code of thisClientException.Returns the user message of thisClientException.static MessagethrowOnError(Message message) Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClientException
public ClientException()Constructs a newClientExceptioninstance. The user message is initialized tonull, and the error code is initialized to zero (0). -
ClientException
Constructs a newClientExceptionwith a message. The user message is initialized tonull, and the error code is initialized to zero (0).- Parameters:
message- the error message.
-
ClientException
Constructs a newClientExceptionwith a cause. The user message is initialized tonull, and the error code is initialized to zero (0).- Parameters:
cause- the cause of the exception.
-
ClientException
-
ClientException
public ClientException(int errorCode) Constructs a newClientExceptionwith 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.
-
ClientException
Constructs a newClientExceptionwith 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.
-
ClientException
Constructs a newClientExceptionwith 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.
-
ClientException
Constructs a newClientExceptionwith 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.
-
ClientException
-
ClientException
Constructs a newClientExceptionwith 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.
-
ClientException
Constructs a newClientExceptionwith 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.
-
ClientException
Constructs a newClientExceptionwith 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 thisClientException.- Returns:
- the user message or
nullif none specified.
-
getErrorCode
public int getErrorCode()Returns the error code of thisClientException. 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 aClientExceptionif thestatusof the supplied message is anerror. TheClientExceptionincludes thestatus,textanduserMessageof themessage. It returns the suppliedmessageif the status issuccessful.- Parameters:
message- the message to be inspected.- Returns:
- the supplied
messageif successful. - Throws:
ClientException- ifmessageisnull.
-