AppBlockList.Error exception (AppBlockList v1.0.0)

Copy Markdown View Source

Error returned (or raised by the bang functions) for anything other than a 200 or 404 answer.

reasonHTTPmeaning
:invalid_id400id missing, too long, or not a recognised identifier
:unauthorized401missing or invalid API key
:quota_exceeded403monthly lookups used; see monthly_lookups/1
:server_error5xxtemporary, safe to retry
:transportnonenetwork failure, timeout or a body that is not JSON
:unexpectedotherany other status

Summary

Functions

The monthly_lookups value from a 403 body, or nil.

True for errors worth retrying later (5xx and transport).

Types

reason()

@type reason() ::
  :invalid_id
  | :unauthorized
  | :quota_exceeded
  | :server_error
  | :transport
  | :unexpected

t()

@type t() :: %AppBlockList.Error{
  __exception__: true,
  body: map(),
  message: String.t(),
  reason: reason(),
  status: non_neg_integer() | nil
}

Functions

monthly_lookups(error)

@spec monthly_lookups(t()) :: integer() | nil

The monthly_lookups value from a 403 body, or nil.

retryable?(error)

@spec retryable?(t()) :: boolean()

True for errors worth retrying later (5xx and transport).