Package com.jk.services.client
Class JKServiceClientException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.jk.core.exceptions.JKException
com.jk.services.client.JKServiceClientException
- All Implemented Interfaces:
Serializable
This class represents exceptions thrown to indicate that client-side error
occurred when communicating with a remote service.
This exception is a subclass of JKException
.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionThis method constructs a newJKServiceClientException
without any specified errors or causes.JKServiceClientException
(JKHttpStatus status) This method constructs aJKServiceClientException
with the specified HTTP status.JKServiceClientException
(String message) This method constructs aJKServiceClientException
with a specific error message.JKServiceClientException
(String serviceName, String url, JKHttpStatus status, String responseMessage) This method constructs aJKServiceClientException
with the provided details.JKServiceClientException
(String serviceName, String url, JKHttpStatus status, String responseMessage, Throwable cause) This method constructs aJKServiceClientException
with the provided details.JKServiceClientException
(String message, Throwable cause) This method constructs aJKServiceClientException
with a specific error message and a cause.JKServiceClientException
(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) This method constructs aJKServiceClientException
with a specific error message, cause, suppression behavior, and stack trace writability.This method constructs aJKServiceClientException
with a cause. -
Method Summary
Modifier and TypeMethodDescriptionThis method retrieves the error code associated with the exception.This method retrieves the error message associated with the exception.This method gets the response message received from the service..This method gets the name of the service associated with the exception.This method retrieves the HTTP status associated with the exception.getUrl()
This method gets the URL associated with the exception.boolean
This method checks if the exception represents a "Not Found" error.void
setErrorCode
(String errorCode) This method sets the error code associated with the exception to the provided value.void
setErrorMessage
(String errorMessage) This method sets the error message associated with the exception to the provided value.void
setResponseMessage
(String responseMessage) This method sets the response message received from the service to the provided value.void
setServiceName
(String serviceName) This method sets the name of the service associated with the exception to the provided value.void
setStatus
(JKHttpStatus status) This method sets the HTTP status associated with the exception to the provided value.void
This method sets the URL associated with the exception to the provided value.Methods inherited from class com.jk.core.exceptions.JKException
isLogged, setLogged
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JKServiceClientException
public JKServiceClientException()This method constructs a newJKServiceClientException
without any specified errors or causes.This constructor is typically used when the exception is thrown to represent a specific error condition without additional details.
-
JKServiceClientException
public JKServiceClientException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) This method constructs aJKServiceClientException
with a specific error message, cause, suppression behavior, and stack trace writability.- Parameters:
message
- Specifies the error message explaining the reason for this exception.cause
- Specifies the cause of this exception.enableSuppression
- Specifies whether suppression is enabled or disabled.writableStackTrace
- Specifies whether the stack trace should be writable.
-
JKServiceClientException
This method constructs aJKServiceClientException
with a specific error message and a cause.- Parameters:
message
- Specifies the error message explaining the reason for this exception.cause
- Specifies the cause of this exception.
-
JKServiceClientException
This method constructs aJKServiceClientException
with a specific error message.- Parameters:
message
- Specifies the error message explaining the reason for this exception.
-
JKServiceClientException
This method constructs aJKServiceClientException
with a cause.- Parameters:
cause
- Specifies the cause of this exception.
-
JKServiceClientException
This method constructs aJKServiceClientException
with the specified HTTP status.- Parameters:
status
- Specifies the HTTP status associated with the exception.
-
JKServiceClientException
public JKServiceClientException(String serviceName, String url, JKHttpStatus status, String responseMessage, Throwable cause) This method constructs aJKServiceClientException
with the provided details.- Parameters:
serviceName
- Specifies the name of the service.url
- Specifies the URL of the service request.status
- Specifies the HTTP status associated with the exception.responseMessage
- Specifies the response message received from the service.cause
- Specifies the cause of the exception.
-
JKServiceClientException
public JKServiceClientException(String serviceName, String url, JKHttpStatus status, String responseMessage) This method constructs aJKServiceClientException
with the provided details.- Parameters:
serviceName
- Specifies the name of the service.url
- Specifies the URL of the service request.status
- Specifies the HTTP status associated with the exception.responseMessage
- Specifies the response message received from the service.
-
-
Method Details
-
getMessage
- Overrides:
getMessage
in classThrowable
-
getServiceName
This method gets the name of the service associated with the exception.- Returns:
- the name of the service associated with the exception.
-
setServiceName
This method sets the name of the service associated with the exception to the provided value.- Parameters:
serviceName
- Specifies the new name of the service associated with the exception.
-
getErrorCode
This method retrieves the error code associated with the exception.- Returns:
- the error code associated with the exception.
-
setErrorCode
This method sets the error code associated with the exception to the provided value.- Parameters:
errorCode
- Specifies the new error code associated with the exception.
-
getErrorMessage
This method retrieves the error message associated with the exception.- Returns:
- the error message associated with the exception.
-
setErrorMessage
This method sets the error message associated with the exception to the provided value.- Parameters:
errorMessage
- Specifies the new error message associated with the exception.
-
getStatus
This method retrieves the HTTP status associated with the exception.- Returns:
- the HTTP status associated with the exception.
-
setStatus
This method sets the HTTP status associated with the exception to the provided value.- Parameters:
status
- Specifies the new HTTP status associated with the exception.
-
getUrl
This method gets the URL associated with the exception.- Returns:
- the URL associated with the exception.
-
setUrl
This method sets the URL associated with the exception to the provided value.- Parameters:
url
- Specifies the new URL associated with the exception.
-
getResponseMessage
This method gets the response message received from the service..- Returns:
- the response message received from the service.
-
setResponseMessage
This method sets the response message received from the service to the provided value.- Parameters:
responseMessage
- Specifies the new response message received from the service.
-
isNotFound
public boolean isNotFound()This method checks if the exception represents a "Not Found" error.- Returns:
- true, if the exception's status is "Not Found," false otherwise.
-