dotenvy
dotenvy copied to clipboard
Better default error for `var(...)`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: EnvVar(NotPresent)'
I was looking into mapping the error and adding context (eg, "missing VAR_XYZ"), but it would be a breaking API change. Any suggestions for how to structure that change?
This is a great idea that is definitely worth implementing. I opened a discussion (#25) for this.
Maybe something like this?
// dotenvy::Error
enum Error {
LineParse(String, usize),
Io(Error),
EnvVar(VarError, String), // name is here
}
This is just a suggestion. It could be possible that the name information could be used for other variants like LineParse, I am not sure yet.
Great, thanks