libflake: add lock file path to invalid json error#12936
Merged
mergify[bot] merged 1 commit intomasterfrom Apr 6, 2025
unknown repository
Merged
libflake: add lock file path to invalid json error#12936mergify[bot] merged 1 commit intomasterfrom unknown repository
mergify[bot] merged 1 commit intomasterfrom
unknown repository
Conversation
roberth
reviewed
Apr 6, 2025
| try { | ||
| return nlohmann::json::parse(contents); | ||
| } catch (const nlohmann::json::parse_error & e) { | ||
| throw Error("While parsing '%s': %s", path, e.what()); |
Member
There was a problem hiding this comment.
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:
Suggested change
| throw Error("While parsing '%s': %s", path, e.what()); | |
| throw Error("Could not parse '%s': %s", path, e.what()); |
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.
Member
|
@mergify queue |
Contributor
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 1dc7e6c |
37 tasks
edolstra
added a commit
that referenced
this pull request
Apr 7, 2025
…2936 libflake: add lock file path to invalid json error (backport #12936)
Contributor
|
This also fixed #6151. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.