pub enum EnvInventoryError {
ReadFileError(String),
ParseFileError(String),
MissingEnvVars(Vec<String>),
MissingEnvVar(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.
MissingEnvVar(String)
Represents the absence of required environment variables. variable.