1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use snafu::Snafu;

pub(super) type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
    #[snafu(display("Page size must be between 1-99. Got: {size}"))]
    InvalidPageSize { size: u64 },
    #[snafu(display("Source cannot be empty"))]
    InvalidSource,
    #[snafu(display("Invalid base64 string: {}", s))]
    Base64Decode {
        s: String,
        source: base64::DecodeSliceError,
    },
    #[snafu(display("Invalid UTF-8 string"))]
    InvalidUtf8 { source: std::str::Utf8Error },
    #[snafu(display("Invalid number: {s}"))]
    InvalidNumber {
        s: String,
        source: std::num::ParseIntError,
    },
}