#[non_exhaustive]
pub enum SerenityError {
Show 14 variants Decode(&'static strValue), Format(FormatError), Io(IoError), Json(JsonError), Model(ModelError), ExceededLimit(Stringu32), NotInRange(&'static stru64u64u64), Other(&'static str), Url(String), Client(ClientError), Collector(CollectorError), Gateway(GatewayError), Http(Box<HttpError>), Tungstenite(TungsteniteError),
}
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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Decode(&'static strValue)

An error while decoding a payload.

Format(FormatError)

There was an error with a format.

Io(IoError)

An std::io error.

Json(JsonError)

An error from the serde_json crate.

Model(ModelError)

An error from the model module.

ExceededLimit(Stringu32)

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 stru64u64u64)

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 ” 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)

Available on crate feature client only.

A client error.

Collector(CollectorError)

Available on crate feature collector only.

A collector error.

Gateway(GatewayError)

Available on crate feature gateway only.

An error from the gateway module.

Http(Box<HttpError>)

Available on crate feature http only.

An error from the http module.

Tungstenite(TungsteniteError)

Available on crate feature gateway only.

An error from the tungstenite crate.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more