Skip to content

Conversation

@nickanderson
Copy link
Member

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

… 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
@nickanderson nickanderson requested a review from larsewi February 11, 2026 20:22
pretty_file("out/masterfiles/def.json")
except json.decoder.JSONDecodeError as e:
raise CFBSExitError(
"Error parsing JSON in 'out/masterfiles/def.json': %s" % e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a parse json operation in _perform_json_step() as used here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this can be a separate todo issue you could log @nickanderson

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I logged ENT-13740

@nickanderson nickanderson merged commit c665e1f into cfengine:master Feb 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants