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: actor.StartError)
ChatInstanceStartError(reason: actor.StartError)
FileNotFoundError
DecodeUpdateError(reason: String)
UnknownUpdateError(update: types.Update)
ActorError(reason: String)
RouterError(reason: String)
}
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 -
ApiToRequestConvertErrorReturned if the bot failed to convert API request to HTTP request
-
SetWebhookError -
NoSessionSettingsError -
RegistryStartError(reason: String) -
BotStartError(reason: actor.StartError) -
ChatInstanceStartError(reason: actor.StartError) -
FileNotFoundError -
DecodeUpdateError(reason: String) -
UnknownUpdateError(update: types.Update)Occurs when the update is not handled by any handler
-
ActorError(reason: String)General actor error (e.g., from polling)
-
RouterError(reason: String)
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.