Codex.Error exception (Codex SDK v0.3.0)

View Source

Base error struct for Codex failures.

Summary

Functions

Normalizes raw error payloads into %Codex.Error{} structs.

Types

t()

@type t() :: %Codex.Error{
  __exception__: true,
  details: map(),
  kind: atom(),
  message: String.t()
}

Functions

new(kind, message, details \\ %{})

@spec new(atom(), String.t(), map()) :: t()

normalize(error)

@spec normalize(term()) :: t()

Normalizes raw error payloads into %Codex.Error{} structs.

Accepts maps emitted by codex-rs (turn.failed), basic strings, or already constructed %Codex.Error{} structs. Known codes and types are classified into stable :kind atoms so callers can branch on error domains (e.g., rate limits, sandbox assessment failures).