Enum env_inventory::EnvInventoryError
source · pub enum EnvInventoryError {
ReadFileError(String),
ParseFileError(String),
MissingEnvVars(Vec<String>),
}Expand description
Represents the potential errors that can be encountered by the
env-inventory module.
This enum provides specific error variants to handle different failure
scenarios when working with environment variable loading and validation in
the env-inventory module. It is designed to give users of the module clear
feedback on the nature of the error encountered.
Variants
ReadFileError: Occurs when there’s an issue reading a settings file.ParseFileError: Occurs when parsing a settings file fails, possibly due to a malformed structure.MissingEnvVars: Occurs when one or more registered environment variables are not present in either the environment or the settings files.
Examples
fn read_settings(file_path: &str) -> Result<(), EnvInventoryError> {
if fs::read(file_path).is_err() {
return Err(EnvInventoryError::ReadFileError(file_path.to_string()));
}
// ... Additional logic ...
Ok(())
}Variants§
ReadFileError(String)
Represents a failure to read a settings file.
Contains a string that provides the path to the file that failed to be read.
ParseFileError(String)
Represents a failure to parse a settings file.
Contains a string that provides the path to the file that failed to be parsed.
MissingEnvVars(Vec<String>)
Represents the absence of required environment variables.
Contains a vector of strings, each representing a missing environment variable.
Trait Implementations§
source§impl Debug for EnvInventoryError
impl Debug for EnvInventoryError
source§impl Display for EnvInventoryError
impl Display for EnvInventoryError
source§impl Error for EnvInventoryError
impl Error for EnvInventoryError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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()
Auto Trait Implementations§
impl RefUnwindSafe for EnvInventoryError
impl Send for EnvInventoryError
impl Sync for EnvInventoryError
impl Unpin for EnvInventoryError
impl UnwindSafe for EnvInventoryError
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