UnifiApi.StreamError exception (UnifiApi v0.4.0)

Copy Markdown View Source

Raised when UnifiApi.Client.stream/3 (or stream_v1/3/stream_paged/2) encounters an API error during pagination and the :raise_errors opt is enabled (default behaviour through v0.4.0).

:reason is always one of the UnifiApi.Error.t/0 members or a {:unexpected_response, body_preview} tuple, so it never carries a raw response body: bodies are reduced to a scrubbed, 128-character preview before the struct is built. This matters because the struct is returned to the caller as the stream's final element by default, so it reaches logs, inspect/1, and exception trackers whether or not it is ever raised (CWE-209 / OWASP A09).

:path is retained verbatim for programmatic handling — it is what a caller needs to resume — and is redacted by message/1. Do not log it as-is.

Summary

Types

kind()

@type kind() :: :auth | :rate_limit | :api | :transport | :unexpected | :unknown

t()

@type t() :: %UnifiApi.StreamError{
  __exception__: true,
  host: String.t() | nil,
  kind: kind(),
  path: String.t(),
  reason: term(),
  status: non_neg_integer() | :unknown
}