Enum teloxide_core::errors::RequestError
source · pub enum RequestError {
Api(ApiError),
MigrateToChatId(ChatId),
RetryAfter(Seconds),
Network(Error),
InvalidJson {
source: Error,
raw: Box<str>,
},
Io(Error),
}
Expand description
An error caused by sending a request to Telegram.
Variants§
Api(ApiError)
A Telegram API error.
MigrateToChatId(ChatId)
The group has been migrated to a supergroup with the specified identifier.
RetryAfter(Seconds)
In case of exceeding flood control, the number of seconds left to wait before the request can be repeated.
Network(Error)
Network error while sending a request to Telegram.
InvalidJson
Error while parsing a response from Telegram.
If you’ve received this error, please, open an issue with the description of the error.
Io(Error)
Occurs when trying to send a file to Telegram.
Trait Implementations§
source§impl AsResponseParameters for RequestError
impl AsResponseParameters for RequestError
fn response_parameters(&self) -> Option<ResponseParameters>
fn retry_after(&self) -> Option<Seconds>
fn migrate_to_chat_id(&self) -> Option<ChatId>
source§impl Debug for RequestError
impl Debug for RequestError
source§impl Display for RequestError
impl Display for RequestError
source§impl Error for RequestError
impl Error for RequestError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<ApiError> for RequestError
impl From<ApiError> for RequestError
source§impl From<DownloadError> for RequestError
impl From<DownloadError> for RequestError
This impl allows to use ?
to propagate DownloadError
s in function
returning RequestError
s. For example:
async fn handler() -> Result<(), RequestError> {
download_file().await?; // `?` just works
Ok(())
}
async fn download_file() -> Result<(), DownloadError> {
/* download file here */
Ok(())
}
source§fn from(download_err: DownloadError) -> Self
fn from(download_err: DownloadError) -> Self
Converts to this type from the input type.
source§impl From<Error> for RequestError
impl From<Error> for RequestError
Auto Trait Implementations§
impl Freeze for RequestError
impl !RefUnwindSafe for RequestError
impl Send for RequestError
impl Sync for RequestError
impl Unpin for RequestError
impl !UnwindSafe for RequestError
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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