pub enum InvocationError {
Rpc(RpcError),
Io(Error),
Deserialize(DeserializeError),
Transport(Error),
Dropped,
InvalidDc,
Authentication(Error),
}Expand description
This error occurs when a Remote Procedure call was unsuccessful.
Variants§
Rpc(RpcError)
The request invocation failed because it was invalid or the server could not process it successfully. If the server is suffering from temporary issues, the request may be retried after some time.
Io(Error)
Standard I/O error when reading the response.
Telegram may kill the connection at any moment, but it is generally valid to retry the request at least once immediately, which will be done through a new connection.
Deserialize(DeserializeError)
Error propagated from attempting to deserialize an invalid tl::Deserializable.
This occurs somewhat frequently when misusing a single session more than once at a time. Otherwise it might happen on bleeding-edge layers that have not had time to settle yet.
Transport(Error)
Error propagated from the underlying transport.
The most common variant is transport::Error::BadStatus, which can occur when
there’s no valid Authorization Key (404) or too many connections have been made (429).
Dropped
The request was cancelled or dropped, and the results won’t arrive.
This may mean that the crate::SenderPoolRunner is no longer running.
InvalidDc
The request was invoked in a datacenter that does not exist or is not known by the session.
Authentication(Error)
The request caused the sender to connect to a new datacenter to be performed, but the Authorization Key generation process failed.
Implementations§
Source§impl InvocationError
impl InvocationError
Sourcepub fn is(&self, rpc_error: &str) -> bool
pub fn is(&self, rpc_error: &str) -> bool
Matches on the name of the RPC error (case-sensitive).
Useful in match arm guards. A single trailing or leading asterisk ('*') is allowed,
and will instead check if the error name starts (or ends with) the input parameter.
If the error is not a RPC error, returns false.
§Examples
match request_result {
Err(err) if err.is("SESSION_PASSWORD_NEEDED") => panic!(),
Err(err) if err.is("PHONE_CODE_*") => {},
_ => panic!()
}