View Source ExPipedrive.Error exception (ex_pipedrive v0.1.0)
Normalized error returned by ExPipedrive public APIs as {:error, %ExPipedrive.Error{}}.
Distinguishes API failures from transport failures and classifies common HTTP
outcomes so callers can pattern-match on :kind:
case ExPipedrive.get_deal(client, id) do
{:ok, deal} -> deal
{:error, %ExPipedrive.Error{kind: :not_found}} -> :missing
{:error, %ExPipedrive.Error{kind: :rate_limited} = err} -> backoff(err)
{:error, %ExPipedrive.Error{kind: :unauthorized}} -> reauth()
{:error, %ExPipedrive.Error{kind: :transport} = err} -> retry?(err)
endDebugging context (status, body, headers, request_id, rate_limit,
original reason) is preserved when available. See ExPipedrive.RateLimit
for the rate_limit map shape.
Summary
Functions
True when the failure came from the Pipedrive API response (not transport).
Builds an error from a completed Tesla response (HTTP layer succeeded).
Builds an error from a Tesla adapter / transport failure.
True when the error is a rate-limit response.
True when the failure was at the HTTP transport layer (no usable response).
True when the error is an auth failure (401 / unauthorized).
Types
@type kind() ::
:validation
| :unauthorized
| :forbidden
| :not_found
| :rate_limited
| :api
| :transport
| :unknown
@type t() :: %ExPipedrive.Error{ __exception__: true, body: term(), headers: [{binary(), binary()}], kind: kind(), message: String.t() | nil, rate_limit: ExPipedrive.RateLimit.t() | nil, reason: term(), request_id: String.t() | nil, status: pos_integer() | nil }
Functions
True when the failure came from the Pipedrive API response (not transport).
@spec from_env(Tesla.Env.t()) :: t()
Builds an error from a completed Tesla response (HTTP layer succeeded).
Builds an error from a Tesla adapter / transport failure.
True when the error is a rate-limit response.
True when the failure was at the HTTP transport layer (no usable response).
True when the error is an auth failure (401 / unauthorized).