zone_update/
errors.rs

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