feat: improve error message for empty package.json files#793
feat: improve error message for empty package.json files#793graphite-app[bot] merged 1 commit intomainfrom
Conversation
How to use the Graphite Merge QueueAdd the label merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #793 +/- ##
==========================================
+ Coverage 93.59% 93.61% +0.01%
==========================================
Files 17 17
Lines 3093 3100 +7
==========================================
+ Hits 2895 2902 +7
Misses 198 198 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #793 will not alter performanceComparing Summary
Footnotes
|
d3c6060 to
0d3bdaa
Compare
Merge activity
|
## Summary Improves error messages for empty package.json files by returning a clear "File is empty" message instead of the cryptic "EOF while parsing a value at line 1 column 0". ## Changes - Add empty file check in `PackageJson::parse()` for both simd and serde implementations - Return `JSONError` with "File is empty" message before attempting JSON parsing - Update tests to expect new error message - Add comprehensive test suite for various corrupted package.json scenarios ## Error Message Improvement **Before:** ``` EOF while parsing a value at line 1 column 0 ``` **After:** ``` File is empty ``` ## Test Plan - ✅ All existing tests pass (150/150) - ✅ Added new test `test_corrupted_package_json` covering multiple scenarios: - Empty file - Null bytes - Trailing commas - Unclosed braces - Invalid escapes - ✅ Updated `incorrect_description_file_2` test for new error message - ✅ Clippy passes with no warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code)
80dd821 to
f74efe2
Compare
Summary
Improves error messages for empty package.json files by returning a clear "File is empty" message instead of the cryptic "EOF while parsing a value at line 1 column 0".
Changes
PackageJson::parse()for both simd and serde implementationsJSONErrorwith "File is empty" message before attempting JSON parsingError Message Improvement
Before:
After:
Test Plan
test_corrupted_package_jsoncovering multiple scenarios:incorrect_description_file_2test for new error message🤖 Generated with Claude Code