Coffrify. Error exception
(Coffrify v0.9.0)
View Source
Errors raised by the Coffrify SDK.
Coffrify.Error is the base struct. Specialised sub-errors give the caller
a fine-grained pattern-match without losing the original response details.
Examples
try do
Coffrify.Resources.Transfers.get(client, "tf_404")
rescue
e in Coffrify.Error.NotFound -> Logger.warn("missing", id: e.details)
e in Coffrify.Error.RateLimited -> :timer.sleep(e.retry_after_ms)
end
Summary
Functions
Build the most specific Coffrify.Error.* struct for a given HTTP status.
Build a Coffrify.Error representing a transport-level failure
(timeout, DNS, TLS, ...).
Types
@type t() :: %Coffrify.Error{ __exception__: true, code: String.t() | nil, details: term(), message: String.t(), request_id: String.t() | nil, status: non_neg_integer() }
Functions
@spec from_response(integer(), term(), keyword()) :: Exception.t()
Build the most specific Coffrify.Error.* struct for a given HTTP status.
Falls back to the generic Coffrify.Error when no specialised exception
exists for the status code.
@spec from_transport( term(), keyword() ) :: Coffrify.Error.Transport.t()
Build a Coffrify.Error representing a transport-level failure
(timeout, DNS, TLS, ...).