Repository navigation
Continue CLI batches after malformed JSON input - #92
xingzhao-ji wants to merge 2 commits into
Conversation
|
Thanks for your contribution! Somehow I have the feeling that this behavior should be optional. What do you think about a |
There was a problem hiding this comment.
The mixed-batch fix works for malformed JSON: I ran the real PR CLI with an invalid file at the beginning, middle and end of two valid files; all three runs retained both valid outputs and exited 1 without a traceback. A remaining adjacent malformed-input case still aborts the batch: a file containing bytes b'{"a":"\xff"}' raises UnicodeDecodeError, and the following valid file is never processed. Consider handling UnicodeDecodeError alongside JSONDecodeError, with the same file-labelled diagnostic and continuation behavior. I ran these checks on Python 3.12; real CLI subprocesses used only synthetic temporary files.
a2b4848 to
15079d6
Compare
Malformed JSON or invalid text encoding currently stops CLI batches before later files are processed. This adds --continue-on-error to report those failures and continue with the remaining files while preserving the default behavior and returning exit status 1. Regression tests cover malformed JSON and invalid encoding, default stopping behavior, valid inputs, and missing-file errors.