Skip to main content

eth_avatars/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum LocatorError {
5    #[error("expected an ipfs or ipns url")]
6    IpfsSchema,
7
8    #[error("url carries no cid")]
9    IpfsEmptyCid,
10
11    #[error("no schema")]
12    NoSchema,
13
14    #[error("invalid")]
15    Invalid,
16}
17
18#[derive(Debug, Error)]
19pub enum FetchError {
20    #[error("no registered fetcher accepts this resource")]
21    Unsupported,
22
23    #[error("resource did not resolve to data within {hops} hops")]
24    TooManyHops { hops: usize },
25
26    #[error("gateway returned status {status}")]
27    Status { status: u16 },
28
29    #[cfg(feature = "reqwest")]
30    #[error(transparent)]
31    Transport(#[from] reqwest::Error),
32
33    #[error(transparent)]
34    Ethereum(#[from] alloy::contract::Error),
35
36    #[error(transparent)]
37    LocatorError(#[from] LocatorError),
38}