nostr_ots/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum Error {
3    #[error("Ureq error: {0}")]
4    Ureq(Box<ureq::Error>), // boxed because ureq::Error is 240 bytes
5
6    #[error(transparent)]
7    Hashes(#[from] bitcoin_hashes::Error),
8
9    #[error(transparent)]
10    Hex(#[from] bitcoin_hashes::hex::Error),
11
12    #[error(transparent)]
13    Ots(#[from] opentimestamps::error::Error),
14
15    #[error(transparent)]
16    Io(#[from] std::io::Error),
17
18    #[error("Calendar server {0} returned HTTPS status code {1} instead of 200 OK")]
19    Not200(String, u16),
20
21    #[error("Out of {aggregators} aggregators, we expected at least {at_least} good responses, but there were these errors: {errors:?}")]
22    TooFewResults {
23        errors: Vec<String>,
24        aggregators: usize,
25        at_least: usize,
26    },
27}
28
29impl From<ureq::Error> for Error {
30    fn from(value: ureq::Error) -> Self {
31        Error::Ureq(Box::new(value))
32    }
33}