Enum teloxide_core::errors::RequestError
source · pub enum RequestError {
Api(ApiError),
MigrateToChatId(i64),
RetryAfter(Duration),
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(i64)
The group has been migrated to a supergroup with the specified identifier.
RetryAfter(Duration)
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<Duration>
fn migrate_to_chat_id(&self) -> Option<i64>
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)>
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.