dig_tls/error.rs
1//! The crate's single error type.
2
3/// Errors from building, loading, or verifying DIG peer mTLS material.
4#[derive(Debug, thiserror::Error)]
5pub enum DigTlsError {
6 /// The embedded or supplied CA PEM could not be parsed.
7 #[error("DigNetwork CA material is invalid: {0}")]
8 Ca(String),
9
10 /// Building or signing a per-peer node certificate failed.
11 #[error("node certificate generation failed: {0}")]
12 CertGen(String),
13
14 /// A stored certificate or key PEM could not be parsed back.
15 #[error("certificate material could not be parsed: {0}")]
16 Parse(String),
17
18 /// A rustls configuration could not be assembled from the material.
19 #[error("rustls configuration failed: {0}")]
20 RustlsConfig(String),
21
22 /// Reading or writing persisted certificate material failed.
23 #[error("certificate persistence I/O failed: {0}")]
24 Io(#[from] std::io::Error),
25}
26
27/// The crate result alias.
28pub type Result<T> = std::result::Result<T, DigTlsError>;