pub enum ConfigError {
Show 15 variants
PropertyNotFound(String),
PropertyHasNoValue(String),
TypeMismatch {
key: String,
expected: DataType,
actual: DataType,
},
ConversionError {
key: String,
message: String,
},
IndexOutOfBounds {
index: usize,
len: usize,
},
SubstitutionError(String),
SubstitutionDepthExceeded(usize),
SubstitutionCycle {
chain: Vec<String>,
},
MergeError(String),
PropertyIsFinal(String),
KeyConflict {
path: String,
existing: String,
incoming: String,
},
IoError(Error),
ParseError(String),
DeserializeError {
path: String,
message: String,
source: Option<Box<ConfigError>>,
},
Other(String),
}Expand description
Configuration error type
Defines all possible error scenarios in the configuration system.
§Examples
use qubit_config::{Config, ConfigError, ConfigResult};
fn get_port(config: &Config) -> ConfigResult<i32> { unimplemented!() }Variants§
PropertyNotFound(String)
Property not found
PropertyHasNoValue(String)
Property has no value
TypeMismatch
Type mismatch at a specific key/path
Fields
ConversionError
Type conversion failed at a specific key/path
Fields
IndexOutOfBounds
Index out of bounds
SubstitutionError(String)
Variable substitution failed
SubstitutionDepthExceeded(usize)
Variable substitution depth exceeded
SubstitutionCycle
Variable substitution cycle detected
MergeError(String)
Configuration merge failed
PropertyIsFinal(String)
Property is final and cannot be overridden
KeyConflict
Configuration key path cannot be represented without ambiguity
Fields
IoError(Error)
IO error
ParseError(String)
Parse error
DeserializeError
Deserialization error for structured config mapping
Fields
§
source: Option<Box<ConfigError>>Original structured error when it came from config parsing
Other(String)
Other error
Implementations§
Source§impl ConfigError
impl ConfigError
Sourcepub fn from_data_conversion_error(key: &str, err: DataConversionError) -> Self
pub fn from_data_conversion_error(key: &str, err: DataConversionError) -> Self
Maps a common data conversion error to a keyed configuration error.
§Parameters
key- Configuration key that was being parsed.err- Error returned by the common conversion layer.
§Returns
A ConfigError carrying the supplied key.
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<(&str, ValueError)> for ConfigError
impl From<(&str, ValueError)> for ConfigError
Source§fn from((key, err): (&str, ValueError)) -> Self
fn from((key, err): (&str, ValueError)) -> Self
Converts to this type from the input type.
Source§impl From<Error> for ConfigError
impl From<Error> for ConfigError
Source§impl From<ValueError> for ConfigError
impl From<ValueError> for ConfigError
Source§fn from(err: ValueError) -> Self
fn from(err: ValueError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ConfigError
impl !RefUnwindSafe for ConfigError
impl Send for ConfigError
impl Sync for ConfigError
impl Unpin for ConfigError
impl UnsafeUnpin for ConfigError
impl !UnwindSafe for ConfigError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
Source§fn into_config_default(self) -> T
fn into_config_default(self) -> T
Converts this fallback value into
T.Source§impl<T> IntoValueDefault<T> for T
impl<T> IntoValueDefault<T> for T
Source§fn into_value_default(self) -> T
fn into_value_default(self) -> T
Converts this argument into the default value.