-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate helpful errors from dotenv! macro #53
Conversation
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
==========================================
- Coverage 86.77% 84.33% -2.44%
==========================================
Files 7 7
Lines 242 249 +7
==========================================
Hits 210 210
- Misses 32 39 +7
Continue to review full report at Codecov.
|
What would you like me to do about those regressions? I'm pretty sure I haven't removed any tests, and the only changes I made were in the macro implementation |
I'll look into it, but its been long enough since code coverage was run, I wouldn't be surprised if its just something going wrong with the codecov tool |
Ooh, I can actually understand the report now. It's identified the couple error cases that I introduced but didn't test. I don't think it's worth putting together a compile error test harness for those couple cases though... |
@Plecra its also in codegen, which can't really be code coverage tested. |
Err(VarError::NotPresent) | Err(VarError::NotUnicode(_)) => panic!("{}", err_msg), | ||
match env::var(var_name.value()) { | ||
Ok(val) => Ok(quote!(#val).into()), | ||
Err(VarError::NotPresent) | Err(VarError::NotUnicode(_)) => Err(syn::Error::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should break up this match arm now that we're producing more descriptive error messages. NotUnicode
doesn't match with environment variable {} not defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a second look at this, I want to mirror the behavior of std::env!
, which actually doesn't differentiate between the two errors. Not that that means we can't though
Continued in #58 |
An implementation for #9