Package africa.sendbyte.exceptions
Class SendByteException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
africa.sendbyte.exceptions.SendByteException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AuthenticationException,AuthorizationException,DomainNotVerifiedException,IdempotencyConflictException,InternalServerException,NotFoundException,RateLimitException,SendByteConnectionException,SuppressedRecipientException,ValidationException
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 Summary
ConstructorsConstructorDescriptionSendByteException(String message, String code, int status, String docsUrl, String requestId) SendByteException(String message, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic SendByteExceptionfromApiError(int status, String code, String message, String docsUrl, String requestId, Integer retryAfterSeconds) Build the most specific exception subclass for an API error response.getCode()Stable machine-readable error code, e.g.Link to the documentation page for this error, ornull.Value of thex-request-idresponse header, ornull.intHTTP status code, or0for transport-level errors.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SendByteException
-
SendByteException
-
-
Method Details
-
getCode
Stable machine-readable error code, e.g.validation_error. May benullfor transport errors. -
getStatus
public int getStatus()HTTP status code, or0for transport-level errors. -
getDocsUrl
Link to the documentation page for this error, ornull. -
getRequestId
Value of thex-request-idresponse header, ornull. -
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.
-