TelegramError
classextends Error
Thrown when the Telegram Bot API responds with ok: false. Exposes the numeric error_code, the human-readable description, and any parameters Telegram returned (e.g. retry_after, migrate_to_chat_id).
Declaration
declare class TelegramError extends Error Properties
readonly code: number;Telegram's numeric error code (mirrors the HTTP status in most cases).
readonly parameters?: ResponseParameters;Extra machine-readable information about the error, when present.
get retryAfter(): number | undefined;Seconds to wait before retrying, when Telegram rate-limits the request (HTTP 429).
Methods
constructor(method: string, code: number, description: string, parameters?: ResponseParameters);Constructs a new instance of the TelegramError class