Backplane.AiProtocol.Error (backplane_ai_protocol v0.7.0)

Copy Markdown

Structured, sanitized protocol error.

message is safe for presentation by default. Provider payloads and opaque state are never placed here by canonical constructors.

Summary

Types

kind()

@type kind() ::
  :invalid_request
  | :authentication
  | :authorization
  | :not_found
  | :rate_limited
  | :upstream_error
  | :incompatible
  | :timeout
  | :cancelled
  | :internal

t()

@type t() :: %Backplane.AiProtocol.Error{
  attempt_id: String.t() | nil,
  compatibility: map() | nil,
  details: map(),
  http_status: pos_integer() | nil,
  kind: kind(),
  message: String.t() | nil,
  partial_output: map() | nil,
  provider_code: String.t() | nil,
  request_id: String.t() | nil,
  retry_after_ms: non_neg_integer() | nil,
  retry_hint: :retryable | :not_retryable | nil,
  stage: atom(),
  upstream_outcome: upstream_outcome() | nil
}

upstream_outcome()

@type upstream_outcome() :: :not_submitted | :known | :unknown

Functions

incompatible(message, compatibility \\ nil, stage \\ :translation)

incompatible!(message, compatibility \\ nil, stage \\ :translation)

@spec incompatible!(String.t(), map() | nil, atom()) :: t()

invalid(message)

@spec invalid(String.t()) :: {:error, t()}

invalid!(message)

@spec invalid!(String.t()) :: t()

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, t()}

wire(message)

@spec wire(String.t()) :: {:error, t()}

wire!(message)

@spec wire!(String.t()) :: t()