Skip to content

fix(macros): report non-IO errors from #[load] instead of ignoring them#165

Open
SAY-5 wants to merge 1 commit into
allan2:mainfrom
SAY-5:fix-load-macro-swallows-parse-errors
Open

fix(macros): report non-IO errors from #[load] instead of ignoring them#165
SAY-5 wants to merge 1 commit into
allan2:mainfrom
SAY-5:fix-load-macro-swallows-parse-errors

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

The #[dotenvy::load] expansion only handled the error case when the source downcast to io::Error, so LineParse and other non-IO errors were silently swallowed, leaving a partially modified environment. This makes the macro print the error and exit non-zero for any error other than a missing non-required file. No runtime test added since the macros crate has no harness for executing expanded code; verified by building a sample binary against a malformed .env. Closes #163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[dotenvy::load] silently ignores parse errors and can partially modify the environment

1 participant