Generate helpful errors from dotenv! macro#53
Generate helpful errors from dotenv! macro#53Plecra wants to merge 2 commits intodotenv-rs:masterfrom Plecra:pretty-compile-error
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.
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.
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