Enum serenity::prelude::SerenityError[][src]

#[non_exhaustive]
pub enum SerenityError {
Show 15 variants Decode(&'static strValue), Format(FormatError), Io(IoError), Json(JsonError), Model(ModelError), Num(ParseIntError), ExceededLimit(Stringu32), NotInRange(&'static stru64u64u64), Other(&'static str), Url(String), Client(ClientError), Gateway(GatewayError), Http(Box<HttpError>), Rustls(RustlsError), 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)

Tuple Fields

0: &'static str
1: Value

An error while decoding a payload.

Format(FormatError)

Tuple Fields

There was an error with a format.

Io(IoError)

Tuple Fields

An std::io error.

Json(JsonError)

Tuple Fields

An error from the serde_json crate.

Model(ModelError)

Tuple Fields

An error from the model module.

Num(ParseIntError)

Tuple Fields

An error occurred while parsing an integer.

ExceededLimit(Stringu32)

Tuple Fields

0: String
1: 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 stru64u64u64)

Tuple Fields

0: &'static str
1: u64
2: u64
3: 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)

Tuple Fields

0: &'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)

Tuple Fields

0: String

An error from the url crate.

Client(ClientError)

Tuple Fields

A client error.

Gateway(GatewayError)

Tuple Fields

An error from the gateway module.

Http(Box<HttpError>)

Tuple Fields

An error from the http module.

Rustls(RustlsError)

Tuple Fields

0: RustlsError

An error occuring in rustls

Tungstenite(TungsteniteError)

Tuple Fields

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

Performs the conversion.

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

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

Performs the conversion.

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