Enum serenity::prelude::SerenityError
source · #[non_exhaustive]pub enum SerenityError {
}
Expand description
A common error enum returned by most of the library’s functionality within a custom Result
.
The most common error types, the ClientError
and GatewayError
enums, are both wrapped
around this in the form of the Self::Client
and Self::Gateway
variants.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Decode(&'static str, Value)
An error while decoding a payload.
Format(Error)
There was an error with a format.
Io(Error)
An std::io
error.
Json(JsonError)
An error from the serde_json
crate.
Model(ModelError)
An error from the model
module.
ExceededLimit(String, u32)
Input exceeded a limit. Providing the input and the limit that’s not supposed to be exceeded.
This only exists for the GuildId::ban
and Member::ban
functions. For their cases,
it’s the “reason”.
NotInRange(&'static str, u64, u64, u64)
The input is not in the specified range. Returned by GuildId::members
,
Guild::members
and PartialGuild::members
(param_name, value, range_min, range_max)
Other(&'static str)
Some other error. This is only used for “Expected value <TYPE>” errors, when a more
detailed error can not be easily provided via the Error::Decode
variant.
Url(String)
An error from the url
crate.
Client(ClientError)
client
only.A client error.
Gateway(GatewayError)
gateway
only.An error from the gateway
module.
Http(HttpError)
http
only.An error from the http
module.
Tungstenite(Error)
gateway
only.An error from the tungstenite
crate.
Trait Implementations§
source§impl Error for Error
impl Error for Error
source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl From<Error> for Error
Available on crate feature gateway
only.
impl From<Error> for Error
gateway
only.source§fn from(e: TungsteniteError) -> Error
fn from(e: TungsteniteError) -> Error
source§impl From<Error> for Error
Available on crate feature http
only.
impl From<Error> for Error
http
only.source§fn from(e: ReqwestError) -> Error
fn from(e: ReqwestError) -> Error
source§impl From<Error> for Error
impl From<Error> for Error
source§fn from(e: ModelError) -> Error
fn from(e: ModelError) -> Error
source§impl From<Error> for Error
Available on crate feature gateway
only.
impl From<Error> for Error
gateway
only.source§fn from(e: GatewayError) -> Error
fn from(e: GatewayError) -> Error
source§impl From<Error> for Error
impl From<Error> for Error
source§fn from(e: FormatError) -> Error
fn from(e: FormatError) -> Error
source§impl From<InvalidHeaderValue> for Error
Available on crate feature http
only.
impl From<InvalidHeaderValue> for Error
http
only.