Class SentinelApiException

All Implemented Interfaces:
Serializable

public final class SentinelApiException extends SentinelException
Thrown when the Sentinel API returns an error response (e.g. 401 Unauthorized, 429 Too Many Requests, or 500 Internal Server Error).

Known 403 validation failures (e.g. expired or blacklisted license) are returned as a failed ValidationResult rather than thrown. Unrecognized 403 responses (e.g. permission denied due to a missing API key) are thrown as this exception.

See Also:
  • Constructor Details

    • SentinelApiException

      public SentinelApiException(int httpStatus, @Nullable String type, String message)
      Creates a new API exception with no retry-after or cause.
      Parameters:
      httpStatus - the HTTP status code
      type - the error type from the API response
      message - the error message from the API response
    • SentinelApiException

      public SentinelApiException(int httpStatus, @Nullable String type, String message, int retryAfterSeconds)
      Creates a new API exception with a retry-after value.
      Parameters:
      httpStatus - the HTTP status code
      type - the error type from the API response
      message - the error message from the API response
      retryAfterSeconds - seconds to wait before retrying, or -1 if not specified
    • SentinelApiException

      public SentinelApiException(int httpStatus, @Nullable String type, String message, @Nullable Throwable cause)
      Creates a new API exception with a cause.
      Parameters:
      httpStatus - the HTTP status code
      type - the error type from the API response
      message - the error message from the API response
      cause - the underlying exception
    • SentinelApiException

      public SentinelApiException(int httpStatus, @Nullable String type, String message, int retryAfterSeconds, @Nullable Throwable cause)
      Creates a new API exception with all fields.
      Parameters:
      httpStatus - the HTTP status code
      type - the error type from the API response
      message - the error message from the API response
      retryAfterSeconds - seconds to wait before retrying, or -1 if not specified
      cause - the underlying exception, or null
  • Method Details

    • getHttpStatus

      public int getHttpStatus()
      Returns the HTTP status code of the error response.
      Returns:
      the HTTP status code
    • getType

      public @Nullable String getType()
      Returns the error type from the API response (e.g. "UNAUTHORIZED").
      Returns:
      the error type, or null
    • getRetryAfterSeconds

      public int getRetryAfterSeconds()
      Returns the number of seconds to wait before retrying, or -1 if the server did not include a Retry-After header.
      Returns:
      the retry-after value in seconds, or -1