Enum serenity::prelude::SerenityError
source · [−]#[non_exhaustive]
pub enum SerenityError {
Show 14 variants
Decode(&'static str, Value),
Format(FormatError),
Io(IoError),
Json(JsonError),
Model(ModelError),
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
Decode(&'static str, Value)
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(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 Error::Decode
variant.
Url(String)
An error from the url
crate.
Client(ClientError)
client
only.A client error.
Collector(CollectorError)
collector
only.A collector error.
Gateway(GatewayError)
gateway
only.An error from the gateway
module.
Http(Box<HttpError>)
http
only.An error from the http
module.
Tungstenite(TungsteniteError)
gateway
only.An error from the tungstenite
crate.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<Error> for Error
impl From<Error> for Error
sourcefn from(e: FormatError) -> Error
fn from(e: FormatError) -> Error
Converts to this type from the input type.
sourceimpl From<Error> for Error
Available on crate feature gateway
only.
impl From<Error> for Error
gateway
only.sourcefn from(e: GatewayError) -> Error
fn from(e: GatewayError) -> Error
Converts to this type from the input type.
sourceimpl From<Error> for Error
impl From<Error> for Error
sourcefn from(e: ModelError) -> Error
fn from(e: ModelError) -> Error
Converts to this type from the input type.
sourceimpl From<Error> for Error
Available on crate feature http
only.
impl From<Error> for Error
http
only.sourcefn from(e: ReqwestError) -> Error
fn from(e: ReqwestError) -> Error
Converts to this type from the input type.
sourceimpl From<InvalidHeaderValue> for Error
Available on crate feature http
only.
impl From<InvalidHeaderValue> for Error
http
only.sourcefn from(e: InvalidHeaderValue) -> Error
fn from(e: InvalidHeaderValue) -> Error
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more