ENT-13735: Prevented crash during cfbs build and provide useful error in case of malformed def.json#303
Merged
nickanderson merged 1 commit intocfengine:masterfrom Feb 12, 2026
Conversation
… malformed def.json When `pretty_file` or `pretty_check_file` encounters invalid JSON, the error now includes the filename, making it easier to identify the problematic file. Ticket: ENT-13735 Changelog: Title
craigcomstock
requested changes
Feb 11, 2026
| pretty_file("out/masterfiles/def.json") | ||
| except json.decoder.JSONDecodeError as e: | ||
| raise CFBSExitError( | ||
| "Error parsing JSON in 'out/masterfiles/def.json': %s" % e |
Contributor
There was a problem hiding this comment.
I think it would be a good idea to explain what out/... especially in this case.
e.g.
"Error parsing built augment file: out/masterfiles/def.json" or something similar.
We should probably parse all the json files processed by the "json" command individually and error out on those instead so the user can just go to the file directly. I feel like mentioning "out" dir might be confusing to a novice user.
| elif operation == "delete": | ||
| _perform_delete_step(args, source, prefix) | ||
| elif operation == "json": | ||
| _perform_json_step(args, source, destination, prefix) |
Contributor
There was a problem hiding this comment.
I would add a parse json operation in _perform_json_step() as used here.
Contributor
There was a problem hiding this comment.
Yes, I think this can be a separate todo issue you could log @nickanderson
larsewi
approved these changes
Feb 12, 2026
craigcomstock
approved these changes
Feb 12, 2026
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.
When
pretty_fileorpretty_check_fileencounters invalid JSON, the errornow includes the filename, making it easier to identify the problematic file.
Ticket: ENT-13735
Changelog: Title