zone_update/
errors.rs

1use std::result;
2use thiserror::Error;
3
4
5/// Error type for operations in this crate.
6///
7/// Represents various failure modes encountered when communicating with
8/// DNS provider APIs or performing local operations.
9#[derive(Debug, Error)]
10pub enum Error {
11    #[error("API usage error: {0}")]
12    ApiError(String),
13
14    #[error("Auth error: {0}")]
15    AuthError(String),
16
17    #[error("HTTP error: {0}")]
18    HttpError(String),
19
20    #[error("URL error: {0}")]
21    UrlError(String),
22
23    #[error("Unexpected record value: {0}")]
24    UnexpectedRecord(String),
25
26    #[error("Record not found: {0}")]
27    RecordNotFound(String),
28
29    #[error(transparent)]
30    AddrParseError(#[from] std::net::AddrParseError),
31
32    #[error(transparent)]
33    UreqError(#[from] ureq::Error),
34
35    #[error("Failed to lock: {0}")]
36    LockingError(String),
37
38    #[error(transparent)]
39    HeaderNameError(#[from] ureq::http::header::InvalidHeaderName),
40
41    #[error(transparent)]
42    HeaderValueError(#[from] ureq::http::header::InvalidHeaderValue),
43
44    #[error(transparent)]
45    IoError(#[from] std::io::Error),
46
47    #[error(transparent)]
48    JsonError(#[from] serde_json::Error),
49
50    // #[error(transparent)]
51    // RustlsError(#[from] rustls::Error),
52}
53
54/// Result type returned by functions in this crate.
55///
56/// Uses the crate-local `Error` type as the error variant.
57pub type Result<T> = result::Result<T, Error>;