Enum tbot::errors::MethodCall
source · pub enum MethodCall {
Network(Error),
OutOfService,
Parse {
response: Vec<u8>,
error: Error,
},
RequestError {
description: String,
error_code: u16,
migrate_to_chat_id: Option<Id>,
retry_after: Option<u64>,
},
}
Expand description
Represents possible errors that may happen during a method call.
Variants§
Network(Error)
A network error.
OutOfService
Bot API is likely to be down.
Parse
Fields
Failed to parse the response.
RequestError
Fields
An error returned in response.
Implementations§
source§impl MethodCall
impl MethodCall
sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Returns true
if self
is of variant Network
.
sourcepub fn expect_network(self) -> Errorwhere
Self: Debug,
pub fn expect_network(self) -> Errorwhere
Self: Debug,
sourcepub fn network(self) -> Option<Error>
pub fn network(self) -> Option<Error>
Returns Some
if self
is of variant Network
, and None
otherwise.
sourcepub fn is_out_of_service(&self) -> bool
pub fn is_out_of_service(&self) -> bool
Returns true
if self
is of variant OutOfService
.
sourcepub fn is_request_error(&self) -> bool
pub fn is_request_error(&self) -> bool
Returns true
if self
is of variant RequestError
.
Trait Implementations§
source§impl Debug for MethodCall
impl Debug for MethodCall
source§impl Display for MethodCall
impl Display for MethodCall
source§impl Error for MethodCall
impl Error for MethodCall
1.30.0 · 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<Error> for MethodCall
impl From<Error> for MethodCall
source§impl From<MethodCall> for HttpWebhook
impl From<MethodCall> for HttpWebhook
source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
source§impl From<MethodCall> for HttpsWebhook
impl From<MethodCall> for HttpsWebhook
source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
source§impl From<MethodCall> for Polling
impl From<MethodCall> for Polling
source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
source§impl From<MethodCall> for PollingSetup
impl From<MethodCall> for PollingSetup
source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.