#[non_exhaustive]pub enum ConfigError {
ConfigRead {
path: PathBuf,
source: Error,
},
ConfigParse {
path: PathBuf,
canonical: Option<PathBuf>,
source: Box<Error>,
},
PathResolve {
path: PathBuf,
source: Error,
},
Validation {
reason: String,
},
RuleSet(RoutingError),
}Expand description
§#[non_exhaustive] (RFC 041)
An enum’s own fields stay constructible across the crate boundary —
#[non_exhaustive] on an enum restricts matching, not building
its existing variants. What it forbids is an exhaustive match
with no wildcard arm, since a future variant would otherwise make
this a silent non-breaking-looking compile error downstream:
use apimock_config::ConfigError;
fn describe(e: &ConfigError) -> &'static str {
match e {
ConfigError::ConfigRead { .. } => "read",
ConfigError::ConfigParse { .. } => "parse",
ConfigError::PathResolve { .. } => "path",
ConfigError::Validation { .. } => "validation",
ConfigError::RuleSet(_) => "rule_set",
// no `_` arm — exhaustive matches outside the crate must
// carry one once the enum is `#[non_exhaustive]`.
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ConfigRead
The config TOML file could not be read from disk.
ConfigParse
The config TOML file was read, but could not be parsed.
PathResolve
A path on disk could not be resolved.
Validation
Startup-time validation failed. reason is the first failure
encountered (RFC 065) — previously a bare unit variant whose
only detail lived in a log::error! call at the failing
validator’s own site, which never reached a caller with no
logger installed (apimock validate/get/set/match-test,
none of which do).
RuleSet(RoutingError)
A rule-set file failed to load or parse. Wraps the routing crate’s error type.
Implementations§
Source§impl ConfigError
impl ConfigError
pub fn kind(&self) -> ConfigErrorKind
Trait Implementations§
Source§impl Debug for ConfigError
impl Debug for ConfigError
Source§impl Display for ConfigError
impl Display for ConfigError
Source§impl Error for ConfigError
impl Error for ConfigError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()