Class SendByteException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AuthenticationException, AuthorizationException, DomainNotVerifiedException, IdempotencyConflictException, InternalServerException, NotFoundException, RateLimitException, SendByteConnectionException, SuppressedRecipientException, ValidationException

public class SendByteException extends RuntimeException
Base type for every error surfaced by the SendByte SDK.

API errors carry a stable, machine-readable code you can branch on, the HTTP status, a docs URL, and the request id (from the x-request-id response header) to quote when contacting support.

Prefer branching on getCode() or catching a specific subclass over matching on the human-readable message.

See Also:
  • Constructor Details

    • SendByteException

      public SendByteException(String message, String code, int status, String docsUrl, String requestId)
    • SendByteException

      public SendByteException(String message, Throwable cause)
  • Method Details

    • getCode

      public String getCode()
      Stable machine-readable error code, e.g. validation_error. May be null for transport errors.
    • getStatus

      public int getStatus()
      HTTP status code, or 0 for transport-level errors.
    • getDocsUrl

      public String getDocsUrl()
      Link to the documentation page for this error, or null.
    • getRequestId

      public String getRequestId()
      Value of the x-request-id response header, or null.
    • fromApiError

      public static SendByteException fromApiError(int status, String code, String message, String docsUrl, String requestId, Integer retryAfterSeconds)
      Build the most specific exception subclass for an API error response.