Noizu.Comms.Error exception (noizu_comms v0.1.0)

Copy Markdown View Source

Structured error returned by every failing call as {:error, %Noizu.Comms.Error{}}.

:kind is one of:

:rate_limited | :unauthorized | :forbidden | :not_found | :invalid
| :window_closed | :transport | :not_configured | :policy_denied

:retry_after_ms is set on :rate_limited when the channel reports a delay. :raw carries a trimmed response summary.

Errors NEVER carry tokens, auth headers or full request URLs with secrets — webhook URLs and phone numbers stay masked here and in the SDKs.

Summary

Types

kind()

@type kind() ::
  :rate_limited
  | :unauthorized
  | :forbidden
  | :not_found
  | :invalid
  | :window_closed
  | :transport
  | :not_configured
  | :policy_denied

t()

@type t() :: %Noizu.Comms.Error{
  __exception__: term(),
  kind: kind(),
  message: String.t() | nil,
  raw: term(),
  retry_after_ms: non_neg_integer() | nil
}

Functions

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

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

Builds an error.