telega/error

Types

pub type TelegaError {
  TelegramApiError(error_code: Int, description: String)
  FetchError(error: dynamic.Dynamic)
  JsonDecodeError(error: json.DecodeError)
  BotHandleUpdateError(reason: String)
  ApiToRequestConvertError
  SetWebhookError
  NoSessionSettingsError
  RegistryStartError(reason: String)
  BotStartError(reason: String)
  ChatInstanceStartError(reason: String)
  FileNotFoundError
  DecodeUpdateError(reason: String)
  UnknownUpdateError(update: model.Update)
}

Constructors

  • TelegramApiError(error_code: Int, description: String)

    Returned by Bot API if server returns ok: false, indicating that your API request was invalid and failed

  • FetchError(error: dynamic.Dynamic)

    Returned if the Bot API server could not be reached or the request failed

  • JsonDecodeError(error: json.DecodeError)

    Returned if the JSON response from the Bot API could not be decoded

  • BotHandleUpdateError(reason: String)

    Returned if the bot failed to call handle_update

  • ApiToRequestConvertError
  • SetWebhookError
  • NoSessionSettingsError
  • RegistryStartError(reason: String)
  • BotStartError(reason: String)
  • ChatInstanceStartError(reason: String)
  • FileNotFoundError
  • DecodeUpdateError(reason: String)
  • UnknownUpdateError(update: model.Update)

Values

pub fn to_string(error: TelegaError) -> String
pub fn try(
  result: Result(a, TelegaError),
  to to_error: fn(TelegaError) -> b,
  fun fun: fn(a) -> Result(c, b),
) -> Result(c, b)

Helper to replace result.try for api call and error mapping.

Search Document