telega/error
Types
pub type TelegaError {
TelegramApiError(error_code: Int, description: String)
FetchError(error: String)
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: String)
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) -> e,
fun fun: fn(a) -> Result(b, e),
) -> Result(b, e)
Helper to replace result.try
for api call and error mapping.