eggbug/error.rs
1/// Errors that might occur when using the library.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum Error {
5 /// Attempted to create or edit a post with no headline, attachments, or markdown content.
6 #[error("post is empty (no headline, attachments, or markdown)")]
7 EmptyPost,
8
9 /// Attempted to create or edit a post with an [`Attachment`][`crate::Attachment`] marked as
10 /// failed.
11 #[error("attempted to use post with failed attachment")]
12 FailedAttachment,
13
14 /// An error while decoding a Base64 string.
15 #[error("base64 decode error: {0}")]
16 Base64Decode(#[from] base64::DecodeError),
17
18 /// An I/O error.
19 #[error("i/o error: {0}")]
20 Io(#[from] std::io::Error),
21
22 /// An HTTP client error (including status codes indicating failure).
23 #[error("request error: {0}")]
24 Request(#[from] reqwest::Error),
25}