-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
libflake: add lock file path to invalid json error #12936
Conversation
src/libflake/flake/lockfile.cc
Outdated
try { | ||
return nlohmann::json::parse(contents); | ||
} catch (const nlohmann::json::parse_error & e) { | ||
throw Error("While parsing '%s': %s", path, e.what()); |
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 had in mind an addTrace
context when I put "while parsing" in the issue, but I think making it part of the final message is nicer, so let's make it sound a bit more natural:
throw Error("While parsing '%s': %s", path, e.what()); | |
throw Error("Could not parse '%s': %s", path, e.what()); |
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.
Thanks! Updated.
Previously, when lock file contained invalid JSON nix reported a parser error without specifying the file it came from. This change adds flake.lock file path to the error message to avoid confusion.
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.
Awesome, thanks!
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 1dc7e6c |
…2936 libflake: add lock file path to invalid json error (backport #12936)
Motivation
Previously, when lock file contained invalid JSON nix reported a parser
error without specifying the file it came from. This behavior is confusing.
Context
This change adds flake.lock file path to the error message to avoid confusion.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.