ExAthena.Error (ExAthena v0.3.1)

Copy Markdown View Source

Canonical error surface across providers.

Summary

Functions

Classify an HTTP status code into an error kind.

Build a canonical error.

Types

kind()

@type kind() ::
  :unauthorized
  | :not_found
  | :rate_limited
  | :timeout
  | :context_length_exceeded
  | :bad_request
  | :server_error
  | :transport
  | :capability
  | :unknown

t()

@type t() :: %ExAthena.Error{
  kind: kind(),
  message: String.t(),
  provider: atom() | module() | nil,
  raw: term() | nil,
  status: integer() | nil
}

Functions

from_status(status)

@spec from_status(integer()) :: kind()

Classify an HTTP status code into an error kind.

Used by providers that share the OpenAI-style response shape.

new(kind, message, opts \\ [])

@spec new(kind(), String.t(), keyword()) :: t()

Build a canonical error.