Package tech.checkhim.exceptions
Class CheckHimException
java.lang.Object
java.lang.Throwable
java.lang.Exception
tech.checkhim.exceptions.CheckHimException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
InvalidFormatException,NetworkRejectedException,PrefixMissingException,SubscriberAbsentException,UnknownSubscriberException
Base exception class for all CheckHim SDK related errors.
This exception is thrown when any error occurs during API communication
or processing of verification requests.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCheckHimException(String message) Creates a new CheckHimException with the specified message.CheckHimException(String message, String errorCode, int httpStatusCode) Creates a new CheckHimException with detailed error information.CheckHimException(String message, String errorCode, int httpStatusCode, Throwable cause) Creates a new CheckHimException with detailed error information and cause.CheckHimException(String message, Throwable cause) Creates a new CheckHimException with the specified message and cause. -
Method Summary
Modifier and TypeMethodDescriptionGets the CheckHim-specific error code.intGets the HTTP status code from the API response.booleanChecks if this exception represents a client error (4xx status code).booleanChecks if this exception represents a server error (5xx status code).toString()Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
CheckHimException
Creates a new CheckHimException with the specified message.- Parameters:
message- The error message
-
CheckHimException
Creates a new CheckHimException with the specified message and cause.- Parameters:
message- The error messagecause- The underlying cause
-
CheckHimException
Creates a new CheckHimException with detailed error information.- Parameters:
message- The error messageerrorCode- The CheckHim error codehttpStatusCode- The HTTP status code from the API response
-
CheckHimException
Creates a new CheckHimException with detailed error information and cause.- Parameters:
message- The error messageerrorCode- The CheckHim error codehttpStatusCode- The HTTP status code from the API responsecause- The underlying cause
-
-
Method Details
-
getErrorCode
Gets the CheckHim-specific error code.- Returns:
- The error code (e.g., "REJECTED_NETWORK"), or null if not available
-
getHttpStatusCode
public int getHttpStatusCode()Gets the HTTP status code from the API response.- Returns:
- The HTTP status code, or 0 if not available
-
isClientError
public boolean isClientError()Checks if this exception represents a client error (4xx status code).- Returns:
- true if the HTTP status code is in the 4xx range
-
isServerError
public boolean isServerError()Checks if this exception represents a server error (5xx status code).- Returns:
- true if the HTTP status code is in the 5xx range
-
toString
-