Alpa.Error (AlpaEx v1.0.3)

View Source

Error types for the Alpa client.

All API errors are wrapped in an Alpa.Error struct with structured information about what went wrong.

Summary

Functions

Create an error from an HTTP response.

Create an invalid response error.

Create a missing credentials error.

Create a network/connection error.

Create a timeout error.

Types

error_type()

@type error_type() ::
  :unauthorized
  | :forbidden
  | :not_found
  | :unprocessable_entity
  | :rate_limited
  | :server_error
  | :network_error
  | :timeout
  | :invalid_response
  | :missing_credentials
  | :unknown

t()

@type t() :: %Alpa.Error{
  code: integer() | nil,
  details: map() | nil,
  message: String.t(),
  type: error_type()
}

Functions

from_response(status, body)

@spec from_response(integer(), map() | String.t()) :: t()

Create an error from an HTTP response.

invalid_response(reason)

@spec invalid_response(term()) :: t()

Create an invalid response error.

missing_credentials()

@spec missing_credentials() :: t()

Create a missing credentials error.

network_error(reason)

@spec network_error(term()) :: t()

Create a network/connection error.

timeout_error()

@spec timeout_error() :: t()

Create a timeout error.