#[non_exhaustive]pub enum ConfigError {
Io {
path: PathBuf,
source: Error,
},
Parse {
path: PathBuf,
source: Box<dyn Error + Send + Sync>,
},
UnknownFields {
keys: Vec<String>,
},
EnvVar {
key: String,
source: VarError,
},
WatchFailed {
source: Box<dyn Error + Send + Sync>,
},
Poisoned,
}Expand description
Loading, parsing, strict-validation, and watching failures.
Documented failure modes are part of the API contract; every variant
lists the condition that produces it. The enum is #[non_exhaustive],
so matches require a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
Reading a configuration file failed at the OS level — the file does
not exist, lacks read permission, or the path is a directory.
Produced by file layers and by
watch when the watched file cannot be read back.
Parse
One of:
- a configuration file failed to parse in its format,
- the file’s extension names a format whose feature is disabled
(
json,yaml), - the merged configuration did not deserialize into the target type.
path is the file involved; for a merge/deserialization mismatch it
is the most recently read file layer (or empty when no file layer
contributed, e.g. a type mismatch introduced by env or overrides
alone).
Fields
UnknownFields
load_strict found top-level
keys that no field of the target type consumed. Nested unknown keys
are deliberately not reported (see load_strict’s documentation for
the precise contract).
EnvVar
An environment variable matching the layer prefix carries a value
that is not valid Unicode. Variables whose key is not valid
Unicode can never match a str prefix and are skipped instead.
Fields
WatchFailed
File watching could not start — the platform watcher could not be
created, the path could not be registered (typically: it does not
exist), or the watcher thread could not be spawned. Produced only by
watch (feature hot-reload).
Poisoned
The watcher’s shared error-slot lock was poisoned by a panic in the watcher thread. Treat as fatal: reload state is indeterminate and the watcher must be stopped and rebuilt.
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()