Skip to content
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

Include the file path when a JSON decoding error happens. #180

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

plietar
Copy link
Member

@plietar plietar commented Sep 12, 2024

If the metadata store is corrupted for some reason, jsonlite throws an error with details of the syntax error, but does not include any mention of the file path.

This adds a wrapper around jsonlite::parse_json which catches the error and includes the file path. It still preserves the original error message, using {rlang} error chaining.

If the metadata store is corrupted for some reason, jsonlite throws an
error with details of the syntax error, but does not include any mention
of the file path.

This adds a wrapper around `jsonlite::parse_json` which catches the
error and includes the file path. It still preserves the original error
message, using [{rlang} error chaining][error-chain].

[error-chain]: https://rlang.r-lib.org/reference/topic-error-chaining.html
@plietar plietar merged commit c916520 into main Sep 13, 2024
10 checks passed
@plietar plietar deleted the mrc-5762-corrupt branch September 13, 2024 13:02
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.

2 participants