sparkle_impostor/
error.rs

1//! The [`Error`] enum
2
3use twilight_validate::{channel::ChannelValidationError, message::MessageValidationError};
4
5/// Error type returned in this library
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8    /// Message is not in a guild
9    #[error("message is not in a guild")]
10    NotInGuild,
11    /// Message is related to rich presence
12    #[error("message is related to rich presence")]
13    RichPresence,
14    /// Message is a voice message
15    #[error("message is a voice message")]
16    Voice,
17    /// Message is a system message
18    #[error("message is a system message")]
19    System,
20    /// Message has a non-URL component
21    #[error("message has a non-URL component")]
22    Component,
23    /// Message has a reaction
24    #[error("message has a reaction")]
25    Reaction,
26    /// Message has more reaction emojis than the limit
27    #[error("message has more reaction emojis than {0}")]
28    ReactionAboveLimit(u8),
29    /// Message has a reaction emoji with count higher than 1
30    #[error("message has a reaction emoji with count higher than one")]
31    ReactionCountMultiple,
32    /// Message has a reaction emoji that's not unicode
33    #[error("message has a reaction emoji that's not unicode")]
34    ReactionCustom,
35    /// Message has an external reaction emoji
36    #[error("message has an external reaction emoji")]
37    ReactionExternal,
38    /// Message has a sticker
39    #[error("message has a sticker")]
40    Sticker,
41    /// Sticker in message can't be linked to
42    #[error("sticker in message can't be linked to")]
43    StickerLinkInvalid,
44    /// Message has an attachment
45    #[error("message has an attachment")]
46    Attachment,
47    /// Message's attachments are too large
48    ///
49    /// This happens when the author has used Nitro perks to send a message with
50    /// over 25 MB of attachments
51    #[cfg(feature = "upload")]
52    #[error("message's attachments are too large")]
53    AttachmentTooLarge,
54    /// Message's content is invalid
55    #[error("message's content is invalid")]
56    ContentInvalid,
57    /// Message is not in last `n` messages
58    #[error("message is not in last {0} messages")]
59    SourceAboveLimit(u16),
60    /// Message has not been created yet
61    #[error("message has not been created yet")]
62    NotCreated,
63    /// Deleting messages would use more than `n` requests
64    #[error("deleting messages would use more than {0} request")]
65    DeleteRequestCountAboveLimit(u16),
66    /// A Twilight HTTP error occurred
67    #[error("{0}")]
68    Http(#[from] twilight_http::Error),
69    /// A deserialize body error was returned
70    #[error("{0}")]
71    DeserializeBody(#[from] twilight_http::response::DeserializeBodyError),
72    /// A validation error was returned
73    #[error("{0}")]
74    Validation(#[from] twilight_validate::request::ValidationError),
75    /// A message validation error was returned
76    #[error("{0}")]
77    MessageValidation(#[from] MessageValidationError),
78    /// A channel validation error was returned
79    #[error("{0}")]
80    ChannelValidation(#[from] ChannelValidationError),
81    /// A reqwest error was returned
82    #[cfg(feature = "upload")]
83    #[error("{0}")]
84    Reqwest(#[from] reqwest::Error),
85}