Structured error type returned by all Column API calls.
Error categories
:api_error— Column returned a 4xx/5xx response with an error body:network_error— Transport-level failure (timeout, connection refused):decode_error— Response body could not be decoded as JSON:validation_error— Local validation failed before making the request
Usage
case Column.BankAccounts.get("bacc_123") do
{:ok, account} -> account
{:error, %Column.Error{type: :api_error, status: 404}} -> handle_not_found()
{:error, %Column.Error{type: :network_error}} -> handle_timeout()
{:error, %Column.Error{} = err} -> handle_generic(err)
end
Summary
Functions
Build a JSON decode error.
Build from a network/transport error.
Build from a Column API error response body + HTTP status.
Build a local validation error.
Types
@type error_type() :: :api_error | :network_error | :decode_error | :validation_error
@type t() :: %Column.Error{ __exception__: true, code: String.t() | nil, message: String.t(), raw: map() | nil, request_id: String.t() | nil, status: non_neg_integer() | nil, type: error_type() }
Functions
Build a JSON decode error.
@spec from_exception(Exception.t()) :: t()
Build from a network/transport error.
@spec from_response(non_neg_integer(), map(), String.t() | nil) :: t()
Build from a Column API error response body + HTTP status.
Build a local validation error.