Hotline.Error exception (Hotline v0.2.1)

Copy Markdown View Source

Structured error type for Telegram API and transport errors.

Summary

Functions

Build an API error from a Telegram error response.

Extract retry_after from error parameters, if present.

Build a transport error.

Types

t()

@type t() :: %Hotline.Error{
  __exception__: true,
  code: integer() | nil,
  message: String.t(),
  parameters: map() | nil,
  type: :api | :transport
}

Functions

api(code, description, parameters \\ nil)

Build an API error from a Telegram error response.

retry_after(error)

Extract retry_after from error parameters, if present.

transport(message)

Build a transport error.