Enum teloxide_core::errors::ApiError
source · [−]#[non_exhaustive]
pub enum ApiError {
Show 64 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,
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,
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.
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
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
sourceimpl<'de> Deserialize<'de> for ApiError
impl<'de> Deserialize<'de> for ApiError
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Error for ApiError
impl Error for ApiError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
impl<T> Erasable for T
impl<T> Erasable for T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
