Enum teloxide_core::errors::ApiError
source · #[non_exhaustive]
pub enum ApiError {
Show 66 variants
BotBlocked,
NotFound,
MessageNotModified,
MessageIdInvalid,
MessageToForwardNotFound,
MessageToDeleteNotFound,
MessageTextIsEmpty,
MessageCantBeEdited,
MessageCantBeDeleted,
MessageToEditNotFound,
MessageToReplyNotFound,
MessageIdentifierNotSpecified,
MessageIsTooLong,
EditedMessageIsTooLong,
ToMuchMessages,
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,
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.
NotFound
Occurs when the bot token is incorrect.
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:
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:
ToMuchMessages
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
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 bot tries GetUpdate before the timeout. Make sure that only one Updater is running.
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
source§impl PartialEq<ApiError> for ApiError
impl PartialEq<ApiError> for ApiError
impl Eq for ApiError
impl StructuralEq for ApiError
impl StructuralPartialEq for ApiError
Auto Trait Implementations§
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnwindSafe for ApiError
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.