allan2 / dotenvy

A well-maintained fork of the dotenv crate
MIT License
664 stars 40 forks source link

add descriptive errors for `var(..)` #15

Closed clifton closed 1 year ago

clifton commented 2 years ago

adds context to error generated by dotenv::var("MISSING_VAR")

before

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: EnvVar(NotPresent)'

to

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: EnvVar(NotPresent): MISSING_VAR'
sonro commented 1 year ago

@clifton if you still consider this change necessary, please contribute to the discussion #25.

allan2 commented 1 year ago

Closing because I don't see this as the final format of the error API.

Feel free to contribute in the discussions.