pub enum RequestError {
Api(ApiError),
MigrateToChatId(ChatId),
RetryAfter(Seconds),
Network(Arc<Error>),
InvalidJson {
source: Arc<Error>,
raw: Box<str>,
},
Io(Arc<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(Arc<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(Arc<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 Clone for RequestError
impl Clone for RequestError
Source§fn clone(&self) -> RequestError
fn clone(&self) -> RequestError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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§fn from(source: ApiError) -> RequestError
fn from(source: ApiError) -> RequestError
Converts to this type from the input type.
Source§impl From<DownloadError> for RequestError
This impl allows to use ? to propagate DownloadErrors in function
returning RequestErrors. For example:
impl From<DownloadError> for RequestError
This impl allows to use ? to propagate DownloadErrors in function
returning RequestErrors. 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) -> RequestError
fn from(download_err: DownloadError) -> RequestError
Converts to this type from the input type.
Source§impl From<Error> for RequestError
impl From<Error> for RequestError
Source§fn from(error: Error) -> RequestError
fn from(error: Error) -> RequestError
Converts to this type from the input type.
Source§impl From<Error> for RequestError
impl From<Error> for RequestError
Source§fn from(err: Error) -> RequestError
fn from(err: Error) -> RequestError
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for RequestError
impl !UnwindSafe for RequestError
impl Forget for RequestError
impl Freeze for RequestErrorwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<Error> is !null: Freeze,
PhantomData<ArcInner<Error>>: Freeze,
*const ArcInner<Error> is !null: Freeze,
PhantomData<ArcInner<Error>>: Freeze,
*const str is !null: Freeze,
PhantomData<str>: Freeze,
*const ArcInner<Error> is !null: Freeze,
PhantomData<ArcInner<Error>>: Freeze,
impl Move for RequestError
impl Send for RequestError
impl Sync for RequestError
impl Unpin for RequestError
impl UnsafeUnpin for RequestErrorwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<Error> is !null: UnsafeUnpin,
PhantomData<ArcInner<Error>>: UnsafeUnpin,
*const ArcInner<Error> is !null: UnsafeUnpin,
PhantomData<ArcInner<Error>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<str>: UnsafeUnpin,
*const ArcInner<Error> is !null: UnsafeUnpin,
PhantomData<ArcInner<Error>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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