Skip to main content

aeo_protocol/
error.rs

1use thiserror::Error;
2
3/// Errors returned by the AEO SDK.
4#[derive(Debug, Error)]
5pub enum AeoError {
6    /// The document was not valid JSON or did not match the AEO schema.
7    #[error("AEO document parse error: {0}")]
8    Parse(#[from] serde_json::Error),
9
10    /// HTTP transport error (only with `client` feature).
11    #[cfg(feature = "client")]
12    #[error("HTTP error: {0}")]
13    Http(#[from] Box<ureq::Error>),
14
15    /// I/O error reading a response body.
16    #[error("I/O error: {0}")]
17    Io(#[from] std::io::Error),
18
19    /// A 4xx or 5xx response was returned by the origin.
20    #[error("AEO fetch failed: HTTP {status} from {url}")]
21    HttpStatus {
22        /// HTTP status code.
23        status: u16,
24        /// The well-known URL that returned the status.
25        url: String,
26    },
27}