Module error

Module error 

Source
Expand description

Facade-level aggregate error.

Each domain owns a typed error describing the failures it knows how to express. This module adds Error: a single non-exhaustive enum over those domain errors, so the bin/admin/cli crates (and future API surfaces) get one match surface at their boundaries instead of eight.

The domains keep their typed errors — a call site that can recover from a specific failure should keep matching the domain error (a quota-aware path matches StoreError::QuotaExceeded, a retry decision matches UpstreamError::ConnectTimeout). Error is for boundary propagation, where the remaining actions are to log, report, or terminate: the bin/admin entry points and future API surfaces. The conversion is lossless — From wraps the domain error unchanged, Display forwards its message, and source returns the inner error, so error chains and downcast_ref on that &dyn Error keep working.

§Example

use dwara_core::error::Error;
use dwara_core::security::tls::TlsError;

let e: Error = TlsError::NoCertificates.into();
assert!(matches!(e, Error::Tls(_)));
// Display delegates to the domain error's message verbatim:
assert_eq!(e.to_string(), "tls terminate block has no certificate material");
// and source() yields the inner error for chains/downcasting:
assert!(std::error::Error::source(&e).is_some());

Enums§

Error
The facade-level aggregate over the domain errors: one type to propagate across crate boundaries (bin/admin entry points, future API surfaces). See the module docs for when to match a domain error instead.