serenity/client/error.rs
1use std::error::Error as StdError;
2use std::fmt;
3
4/// An error returned from the [`Client`].
5///
6/// This is always wrapped within the library's generic [`Error::Client`] variant.
7///
8/// [`Client`]: super::Client
9/// [`Error::Client`]: crate::Error::Client
10#[derive(Clone, Debug, Eq, Hash, PartialEq)]
11#[non_exhaustive]
12pub enum Error {
13 /// When a shard has completely failed to reboot after resume and/or reconnect attempts.
14 ShardBootFailure,
15 /// When all shards that the client is responsible for have shutdown with an error.
16 Shutdown,
17}
18
19impl fmt::Display for Error {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match self {
22 Self::ShardBootFailure => f.write_str("Failed to (re-)boot a shard"),
23 Self::Shutdown => f.write_str("The clients shards shutdown"),
24 }
25 }
26}
27
28impl StdError for Error {}