Noizu.Google.Error exception (Noizu Google v0.2.3)

Copy Markdown View Source

Structured error returned by Google API calls.

Raised as an exception when needed (defexception), but the HTTP and API modules return {:error, %Noizu.Google.Error{}} instead of raising.

  • :reason:http_error, :config, or the underlying transport/codec term
  • :tag — Google error.status / error.code, or :transport / :codec / :config
  • :status — HTTP status when the response arrived
  • :body — decoded JSON (or raw body) from Google

Summary

Functions

Build an encoding/decoding error.

Missing configuration (token, credentials, etc.).

Build an error from an HTTP response body (JSON map or raw).

Build a transport / client-side error.

Types

t()

@type t() :: %Noizu.Google.Error{
  __exception__: term(),
  body: term(),
  message: String.t(),
  reason: term(),
  status: pos_integer() | nil,
  summary: String.t() | nil,
  tag: String.t() | atom() | nil
}

Functions

codec(reason)

@spec codec(term()) :: t()

Build an encoding/decoding error.

config(message)

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

Missing configuration (token, credentials, etc.).

from_response(status, body)

@spec from_response(pos_integer(), term()) :: t()

Build an error from an HTTP response body (JSON map or raw).

transport(reason)

@spec transport(term()) :: t()

Build a transport / client-side error.