Class AnkaSecureSdkException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
co.ankatech.ankasecure.sdk.exception.AnkaSecureSdkException
All Implemented Interfaces:
Serializable

public final class AnkaSecureSdkException extends RuntimeException
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 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. The error code is initialized to SdkErrorCode.UNKNOWN for backward compatibility.
      Parameters:
      message - the detail message for this exception
      httpStatus - the HTTP status code associated with this error
      responseBody - the body of the HTTP response returned by the remote service
      cause - the underlying cause of this exception (may be null)
      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 exception
      httpStatus - the HTTP status code associated with this error
      responseBody - the body of the HTTP response returned by the remote service
      cause - the underlying cause of this exception (may be null)
      context - additional context information as key-value pairs
      errorCode - the SdkErrorCode 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

      public String getResponseBody()
      Returns the full response body returned by the remote service.
      Returns:
      the HTTP response body as a string
    • getContext

      public Map<String,String> getContext()
      Returns additional context information provided with this exception.
      Returns:
      an unmodifiable map of context key-value pairs
    • getErrorCode

      public SdkErrorCode getErrorCode()
      Returns the specific SDK error code categorizing this failure.
      Returns:
      the SdkErrorCode for this exception