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

#[non_exhaustive]
pub enum SerenityError {
Show 15 variants Decode(&'static str, Value), Format(FormatError), Io(IoError), Json(JsonError), Model(ModelError), Num(ParseIntError), ExceededLimit(String, u32), NotInRange(&'static str, u64, u64, u64), 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

An error while decoding a payload.

Tuple Fields of Decode

0: &'static str1: Value
Format

There was an error with a format.

Tuple Fields of Format

0: FormatError
Io

An std::io error.

Tuple Fields of Io

0: IoError
Json

An error from the serde_json crate.

Tuple Fields of Json

0: JsonError
Model

An error from the model module.

Tuple Fields of Model

0: ModelError
Num

An error occurred while parsing an integer.

Tuple Fields of Num

0: ParseIntError
ExceededLimit

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

Tuple Fields of ExceededLimit

0: String1: u32
NotInRange

The input is not in the specified range. Returned by GuildId::members, Guild::members and PartialGuild::members

(param_name, value, range_min, range_max)

Tuple Fields of NotInRange

0: &'static str1: u642: u643: u64
Other

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.

Tuple Fields of Other

0: &'static str
Url

An error from the url crate.

Tuple Fields of Url

0: String
Client

A client error.

Tuple Fields of Client

0: ClientError
Collector

A collector error.

Tuple Fields of Collector

0: CollectorError
Gateway

An error from the gateway module.

Tuple Fields of Gateway

0: GatewayError
Http

An error from the http module.

Tuple Fields of Http

0: Box<HttpError>
Tungstenite

An error from the tungstenite crate.

Tuple Fields of Tungstenite

0: TungsteniteError

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.