pub enum SecretError {
FileNotFound(PathBuf),
Io {
path: PathBuf,
source: Error,
},
InvalidSyntax {
path: PathBuf,
line: usize,
message: String,
},
}Expand description
Errors that can occur while loading secrets from a source.
These errors are typically encountered when loading a .env file via crate::EnvFileSource.
Use pattern matching to distinguish between missing files, I/O errors, and parse errors.
Variants§
FileNotFound(PathBuf)
The .env file path was explicitly provided but does not exist.
This error is returned by crate::EnvFileSource::load when the file is not found.
Use crate::EnvFileSource::load_optional instead if the file is allowed to be absent.
Io
An I/O error occurred while reading the file.
This wraps the underlying filesystem error. Common causes include permission denied, invalid path, or disk read failures.
Fields
InvalidSyntax
A line in the file could not be parsed as KEY=VALUE.
The syntax is described in crate::EnvFileSource. This error includes the exact
line number (1-based) and a diagnostic message.
Trait Implementations§
Source§impl Debug for SecretError
impl Debug for SecretError
Source§impl Display for SecretError
impl Display for SecretError
Source§impl Error for SecretError
impl Error for SecretError
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()