Class AnkaSecureSdkException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
co.ankatech.ankasecure.sdk.exception.AnkaSecureSdkException
- All Implemented Interfaces:
Serializable
A uniform, localization-ready exception thrown by all public AnkaSecure SDK APIs.
This exception carries HTTP error information returned by a remote service, including status code, response body, and an optional SDK error code. It also allows attaching arbitrary context data for richer diagnostics.
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAnkaSecureSdkException
(String message, int httpStatus, String responseBody, Throwable cause, Map<String, String> context) Constructs a new SDK exception with the specified message, HTTP status, response body, cause, and context.AnkaSecureSdkException
(String message, int httpStatus, String responseBody, Throwable cause, Map<String, String> context, SdkErrorCode errorCode) Constructs a new SDK exception with the specified message, HTTP status, response body, cause, context, and a specific SDK error code. -
Method Summary
Modifier and TypeMethodDescriptionReturns additional context information provided with this exception.Returns the specific SDK error code categorizing this failure.int
Returns the HTTP status code returned by the remote service.Returns the full response body returned by the remote service.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AnkaSecureSdkException
public AnkaSecureSdkException(String message, int httpStatus, String responseBody, Throwable cause, Map<String, String> context) Constructs a new SDK exception with the specified message, HTTP status, response body, cause, and context. Theerror code
is initialized toSdkErrorCode.UNKNOWN
for backward compatibility.- Parameters:
message
- the detail message for this exceptionhttpStatus
- the HTTP status code associated with this errorresponseBody
- the body of the HTTP response returned by the remote servicecause
- the underlying cause of this exception (may benull
)context
- additional context information as key-value pairs- Since:
- 1.0.0
-
AnkaSecureSdkException
public AnkaSecureSdkException(String message, int httpStatus, String responseBody, Throwable cause, Map<String, String> context, SdkErrorCode errorCode) Constructs a new SDK exception with the specified message, HTTP status, response body, cause, context, and a specific SDK error code.- Parameters:
message
- the detail message for this exceptionhttpStatus
- the HTTP status code associated with this errorresponseBody
- the body of the HTTP response returned by the remote servicecause
- the underlying cause of this exception (may benull
)context
- additional context information as key-value pairserrorCode
- theSdkErrorCode
representing the specific error condition- Since:
- 1.0.0
-
-
Method Details
-
getHttpStatus
public int getHttpStatus()Returns the HTTP status code returned by the remote service.- Returns:
- the HTTP status code
-
getResponseBody
Returns the full response body returned by the remote service.- Returns:
- the HTTP response body as a string
-
getContext
-
getErrorCode
Returns the specific SDK error code categorizing this failure.- Returns:
- the
SdkErrorCode
for this exception
-