AdyenClient.Error exception (AdyenClient v1.0.0)

Copy Markdown View Source

Structured error types returned by all AdyenClient API calls.

All API functions return {:ok, response} or {:error, AdyenClient.Error.t()}.

Summary

Functions

Build a config error.

Build an error from an Adyen API error response body.

Build a network/timeout error.

Build a webhook validation error.

Types

error_type()

@type error_type() ::
  :api_error
  | :auth_error
  | :validation_error
  | :not_found
  | :rate_limited
  | :server_error
  | :network_error
  | :timeout
  | :config_error
  | :webhook_validation_error

t()

@type t() :: %AdyenClient.Error{
  __exception__: true,
  error_code: String.t() | nil,
  message: String.t(),
  psp_reference: String.t() | nil,
  raw: map() | nil,
  retryable: boolean(),
  status: non_neg_integer() | nil,
  type: error_type()
}

Functions

config(message)

@spec config(String.t()) :: t()

Build a config error.

from_response(body, status)

@spec from_response(map(), non_neg_integer()) :: t()

Build an error from an Adyen API error response body.

network(message, retryable \\ true)

@spec network(String.t(), boolean()) :: t()

Build a network/timeout error.

webhook_validation(message)

@spec webhook_validation(String.t()) :: t()

Build a webhook validation error.