Noizu.Slack.Error exception (Noizu.Slack v0.1.0)

Copy Markdown View Source

Structured error returned by every failing Noizu.Slack call as {:error, %Noizu.Slack.Error{}} — never raised in the normal flow.

The struct implements Exception so a mid-stream pagination failure can raise it (Streams cannot return error tuples).

Fields:

  • :tag — failure class:
    • :api — Slack answered {"ok": false, "error": "..."}; :reason is the Slack error string (e.g. "channel_not_found"), kept verbatim (no atoms are created from network data).
    • :rate_limited — HTTP 429 persisted past the bounded retry; :reason is the Slack error string when present (usually "ratelimited").
    • :http — any other non-2xx response without an ok:false envelope.
    • :invalid_response — a 2xx response whose body is not a Slack envelope.
    • :transport — connection refused, timeout, TLS…; :reason is the exception.
    • :config — missing token or bad arguments; :reason is an atom.
    • :upload — the files.upload byte-transfer step failed.
    • :webhook — an incoming-webhook post failed; :reason is Slack's text body.
    • :signature — Noizu.Slack.Signature.verify/5 rejected a request; :reason is :invalid_signature, :stale_timestamp, or :invalid_timestamp.
    • :blocks — Noizu.Slack.Blocks.validate/1 rejected a payload.
  • :status — HTTP status when a response arrived.
  • :body — decoded response body (map) or raw body.
  • :message / :summary — human-readable description.

Summary

Types

t()

@type t() :: %Noizu.Slack.Error{
  __exception__: term(),
  body: term(),
  message: String.t() | nil,
  reason: term(),
  status: pos_integer() | nil,
  summary: String.t() | nil,
  tag: tag() | nil
}

tag()

@type tag() ::
  :api
  | :rate_limited
  | :http
  | :invalid_response
  | :transport
  | :config
  | :upload
  | :webhook
  | :signature
  | :blocks