Enum teloxide_core::errors::ApiError
source · #[non_exhaustive]pub enum ApiError {
Show 67 variants
BotBlocked,
InvalidToken,
MessageNotModified,
MessageIdInvalid,
MessageToForwardNotFound,
MessageToDeleteNotFound,
MessageToCopyNotFound,
MessageTextIsEmpty,
MessageCantBeEdited,
MessageCantBeDeleted,
MessageToEditNotFound,
MessageToReplyNotFound,
MessageIdentifierNotSpecified,
MessageIsTooLong,
EditedMessageIsTooLong,
TooMuchMessages,
TooMuchInlineQueryResults,
PollHasAlreadyClosed,
PollMustHaveMoreOptions,
PollCantHaveMoreOptions,
PollOptionsMustBeNonEmpty,
PollQuestionMustBeNonEmpty,
PollOptionsLengthTooLong,
PollQuestionLengthTooLong,
MessageWithPollNotFound,
MessageIsNotAPoll,
ChatNotFound,
UserNotFound,
ChatDescriptionIsNotModified,
InvalidQueryId,
ButtonUrlInvalid,
ButtonDataInvalid,
TextButtonsAreUnallowed,
WrongFileId,
WrongFileIdOrUrl,
FailedToGetUrlContent,
GroupDeactivated,
ImageProcessFailed,
PhotoAsInputFileRequired,
InvalidStickersSet,
StickerSetNameOccupied,
StickerSetOwnerIsBot,
InvalidStickerName,
NotEnoughRightsToPinMessage,
NotEnoughRightsToManagePins,
NotEnoughRightsToChangeChatPermissions,
MethodNotAvailableInPrivateChats,
CantDemoteChatCreator,
CantRestrictSelf,
NotEnoughRightsToRestrict,
NotEnoughRightsToPostMessages,
WebhookRequireHttps,
BadWebhookPort,
UnknownHost,
CantParseUrl,
CantParseEntities(String),
CantGetUpdates,
BotKicked,
BotKickedFromSupergroup,
UserDeactivated,
CantInitiateConversation,
CantTalkWithBots,
WrongHttpUrl,
TerminatedByOtherGetUpdates,
FileIdInvalid,
RequestEntityTooLarge,
Unknown(String),
}
Expand description
A kind of an API error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BotBlocked
Occurs when the bot tries to send message to user who blocked the bot.
InvalidToken
Occurs when the bot token is invalid.
MessageNotModified
Occurs when bot tries to modify a message without modification content.
May happen in methods:
MessageIdInvalid
Occurs when bot tries to forward or delete a message which was deleted.
May happen in methods:
MessageToForwardNotFound
Occurs when bot tries to forward a message which does not exists.
May happen in methods:
MessageToDeleteNotFound
Occurs when bot tries to delete a message which does not exists.
May happen in methods:
MessageToCopyNotFound
Occurs when bot tries to copy a message which does not exists. May happen in methods:
MessageTextIsEmpty
MessageCantBeEdited
MessageCantBeDeleted
Occurs when bot tries to delete a someone else’s message in group where it does not have enough rights.
May happen in methods:
MessageToEditNotFound
Occurs when bot tries to edit a message which does not exists.
May happen in methods:
MessageToReplyNotFound
Occurs when bot tries to reply to a message which does not exists.
May happen in methods:
MessageIdentifierNotSpecified
Occurs when bot tries to
MessageIsTooLong
Occurs when bot tries to send a message with text size greater then 4096 symbols.
May happen in methods:
EditedMessageIsTooLong
Occurs when bot tries to edit a message with text size greater then 4096 symbols.
May happen in methods:
TooMuchMessages
Occurs when bot tries to send media group with more than 10 items.
May happen in methods:
TooMuchInlineQueryResults
Occurs when bot tries to answer an inline query with more than 50 results.
Consider using offsets to paginate results.
May happen in methods:
PollHasAlreadyClosed
PollMustHaveMoreOptions
PollCantHaveMoreOptions
PollOptionsMustBeNonEmpty
Occurs when bot tries to send poll with empty option (without text).
May happen in methods:
PollQuestionMustBeNonEmpty
Occurs when bot tries to send poll with empty question (without text).
May happen in methods:
PollOptionsLengthTooLong
Occurs when bot tries to send poll with total size of options more than 100 symbols.
May happen in methods:
PollQuestionLengthTooLong
Occurs when bot tries to send poll with question size more than 255 symbols.
May happen in methods:
MessageWithPollNotFound
MessageIsNotAPoll
ChatNotFound
Occurs when bot tries to send a message to chat in which it is not a member.
May happen in methods:
UserNotFound
Occurs when bot tries to send method with unknown user_id.
May happen in methods:
ChatDescriptionIsNotModified
Occurs when bot tries to send SetChatDescription
with same text as
in the current description.
May happen in methods:
InvalidQueryId
Occurs when bot tries to answer to query after timeout expire.
May happen in methods:
ButtonUrlInvalid
Occurs when bot tries to send InlineKeyboardMarkup with invalid button url.
May happen in methods:
ButtonDataInvalid
Occurs when bot tries to send button with data size more than 64 bytes.
May happen in methods:
TextButtonsAreUnallowed
WrongFileId
WrongFileIdOrUrl
Occurs when bot tries to send files with wrong file identifier or HTTP url
FailedToGetUrlContent
Occurs when When sending files with an url to a site that doesn’t respond.
GroupDeactivated
Occurs when bot tries to do some with group which was deactivated.
ImageProcessFailed
Occurs when image processing fails on telegram’s side.
This is likely caused by an incorrectly encoded image, make sure that the image is correctly encoded in a format telegram accepts.
PhotoAsInputFileRequired
InvalidStickersSet
Occurs when bot tries to add sticker to stickerset by invalid name.
May happen in methods:
StickerSetNameOccupied
Occurs when bot tries to create a sticker set with a name that is already used by another sticker set.
May happen in methods:
StickerSetOwnerIsBot
Occurs when bot tries to create a sticker set with user id of a bot.
May happen in methods:
InvalidStickerName
Occurs when bot tries to create a sticker set with invalid name.
From documentation of CreateNewStickerSet
:
Short name of sticker set, to be used in
t.me/addstickers/
URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can’t contain consecutive underscores and must end in “_by_<bot_username>”. <bot_username> is case insensitive. 1-64 characters.
May happen in methods:
NotEnoughRightsToPinMessage
Occurs when bot tries to pin a message without rights to pin in this chat.
May happen in methods:
NotEnoughRightsToManagePins
Occurs when bot tries to pin or unpin a message without rights to pin in this chat.
May happen in methods:
NotEnoughRightsToChangeChatPermissions
Occurs when bot tries change default chat permissions without “Ban Users” permission in this chat.
May happen in methods:
MethodNotAvailableInPrivateChats
Occurs when bot tries to use method in group which is allowed only in a supergroup or channel.
CantDemoteChatCreator
CantRestrictSelf
NotEnoughRightsToRestrict
Occurs when bot tries to restrict chat member without rights to restrict in this chat.
May happen in methods:
NotEnoughRightsToPostMessages
Occurs when bot tries to post a message in a channel without “Post Messages” admin right.
WebhookRequireHttps
BadWebhookPort
Occurs when bot tries to set webhook to port other than 80, 88, 443 or 8443.
May happen in methods:
UnknownHost
CantParseUrl
CantParseEntities(String)
CantGetUpdates
BotKicked
BotKickedFromSupergroup
Occurs when bot tries to do something in a supergroup the bot was kicked from.
May happen in methods:
UserDeactivated
Occurs when bot tries to send a message to a deactivated user (i.e. a user that was banned by telegram).
May happen in methods:
CantInitiateConversation
CantTalkWithBots
WrongHttpUrl
TerminatedByOtherGetUpdates
Occurs when multiple GetUpdates
calls happen at the same time.
This can happen if
- You are running multiple bot instances
- You are running multiple update consumers (like
Dispatcher
orrepl
) - You are calling
GetUpdates
yourself and the second call is done before the first one finishes
May happen in methods:
FileIdInvalid
RequestEntityTooLarge
Occurs when bot tries to upload a file which is larger than 50 MB using multipart/form-data.
May happen in methods:
Unknown(String)
Error which is not known to teloxide
.
If you’ve received this error, please open an issue with the description of the error.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ApiError
impl<'de> Deserialize<'de> for ApiError
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl Error for ApiError
impl Error for ApiError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<ApiError> for RequestError
impl From<ApiError> for RequestError
impl Eq for ApiError
impl StructuralPartialEq for ApiError
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnwindSafe for ApiError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Erasable for T
impl<T> Erasable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more