TelegramEx.Error (TelegramEx v1.3.0)

Copy Markdown View Source

Struct representing an error returned by the Telegram Bot API.

Captures Telegram error responses in a structured form.

Fields

  • :type - Source of the error (:telegram for API errors)
  • :code - Numeric error code from error_code (nil if absent)
  • :reason - Optional atom describing the error (nil unless provided)
  • :description - Human-readable description from the API
  • :retry_after - Seconds to wait before retrying, from parameters.retry_after (nil if absent)
  • :raw - The raw response body, for callers that need the full payload

Summary

Types

t()

Error struct type.

Functions

Builds an Error struct from a raw Telegram API response body.

Types

t()

@type t() :: %TelegramEx.Error{
  code: integer() | nil,
  description: String.t() | nil,
  raw: map() | nil,
  reason: atom() | nil,
  retry_after: integer() | nil,
  type: atom()
}

Error struct type.

Carries the structured details of a failed Telegram API request.

Functions

from_body(body)

@spec from_body(map()) :: t()

Builds an Error struct from a raw Telegram API response body.