GoCardlessClient.APIError exception (GoCardlessClient v2.0.0)

Copy Markdown View Source

Structured error returned by the GoCardlessClient API.

Fields

  • :status — HTTP status code
  • :type"gocardless_error", "invalid_api_usage", "invalid_state", "validation_failed"
  • :message — human-readable description
  • :request_id — GoCardlessClient request ID for support
  • :documentation_url — relevant API docs URL
  • :errors — list of GoCardlessClient.FieldError for validation failures

Summary

Functions

Returns true if this is a 409 Conflict error.

Builds an APIError from a decoded JSON response body.

Returns true if the action cannot be performed in the resource's current state.

Returns true if this is a 404 Not Found error.

Returns true if this is a 429 rate-limited response.

Returns true if this is an internal GoCardlessClient server error.

Returns true if this is a 422 validation failure.

Types

t()

@type t() :: %GoCardlessClient.APIError{
  __exception__: true,
  documentation_url: String.t() | nil,
  errors: [GoCardlessClient.FieldError.t()],
  message: String.t() | nil,
  raw: map() | nil,
  request_id: String.t() | nil,
  status: non_neg_integer(),
  type: String.t() | nil
}

Functions

conflict?(arg1)

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

Returns true if this is a 409 Conflict error.

from_response(status, raw)

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

Builds an APIError from a decoded JSON response body.

invalid_state?(arg1)

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

Returns true if the action cannot be performed in the resource's current state.

not_found?(arg1)

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

Returns true if this is a 404 Not Found error.

rate_limited?(arg1)

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

Returns true if this is a 429 rate-limited response.

server_error?(arg1)

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

Returns true if this is an internal GoCardlessClient server error.

validation_failed?(arg1)

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

Returns true if this is a 422 validation failure.