Synctera.Error exception (Synctera v1.0.0)

Copy Markdown View Source

Raised/returned for non-2xx responses from the Synctera API.

Functions in Synctera.* resource modules return {:error, %Synctera.Error{}} in their non-bang form, and raise this struct (it implements the Exception behaviour) in their bang (!) form.

Summary

Functions

True for a 401 Unauthorized response.

True for a 400 Bad Request response.

True for a 409 Conflict response. This includes Synctera's IDEMPOTENCY_CONCURRENT_USE conflicts on money-movement endpoints.

Builds a Synctera.Error from an HTTP status, decoded body, and request context.

True for a 404 Not Found response.

True for a 403 Forbidden response.

True for a 429 Too Many Requests response. The client already retries these internally up to the configured retry limit.

True for any 5xx response.

True for a 422 Unprocessable Entity response. This includes Synctera's IDEMPOTENCY_INVALID_REUSE errors.

Types

t()

@type t() :: %Synctera.Error{
  __exception__: true,
  body: map() | nil,
  code: String.t() | nil,
  message: String.t(),
  method: String.t(),
  request_id: String.t() | nil,
  retry_after: non_neg_integer() | nil,
  status: pos_integer(),
  url: String.t()
}

Functions

authentication_error?(arg1)

@spec authentication_error?(term()) :: boolean()

True for a 401 Unauthorized response.

bad_request?(arg1)

@spec bad_request?(term()) :: boolean()

True for a 400 Bad Request response.

conflict?(arg1)

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

True for a 409 Conflict response. This includes Synctera's IDEMPOTENCY_CONCURRENT_USE conflicts on money-movement endpoints.

from_response(status, method, url, body, request_id, retry_after \\ nil)

@spec from_response(
  pos_integer(),
  String.t(),
  String.t(),
  map() | nil,
  String.t() | nil,
  non_neg_integer() | nil
) :: t()

Builds a Synctera.Error from an HTTP status, decoded body, and request context.

not_found?(arg1)

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

True for a 404 Not Found response.

permission_error?(arg1)

@spec permission_error?(term()) :: boolean()

True for a 403 Forbidden response.

rate_limited?(arg1)

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

True for a 429 Too Many Requests response. The client already retries these internally up to the configured retry limit.

server_error?(arg1)

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

True for any 5xx response.

validation_error?(arg1)

@spec validation_error?(term()) :: boolean()

True for a 422 Unprocessable Entity response. This includes Synctera's IDEMPOTENCY_INVALID_REUSE errors.