YtPotion.Error (yt_potion v1.0.0)

Copy Markdown

Error struct returned by any yt_potion call that can fail at runtime.

:type distinguishes three failure categories:

  • :http_error — the HTTP request itself failed or returned a non-2xx status. :status and :body are populated when available.
  • :api_error — the request succeeded at the HTTP level but the YouTube API returned an "error" payload.
  • :config_error — yt_potion is not configured (missing API key).

Summary

Types

t()

@type t() :: %YtPotion.Error{
  body: term() | nil,
  message: String.t(),
  status: integer() | nil,
  type: type()
}

type()

@type type() :: :http_error | :api_error | :config_error

Functions

api_error(message)

@spec api_error(String.t()) :: t()

config_error(message \\ "YtPotion is not configured")

@spec config_error(String.t()) :: t()

http_error(status, body)

@spec http_error(integer() | nil, term()) :: t()