capture and report job deserialization errors #11179
Open
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.
The
job.json
file is passed to all update steps which means we need to be able to report all parsing errors as they occur.Originally this work started because a requirement was specified in the job file that could not be parsed, so part of this PR is to return the well-known error
illformed_requirement
, represented asBadRequirementError
.Most of this PR was to make testing possible, but ultimately it comes down to 2 major changes:
discover
command. All subsequent commands also parse the job file, but any failure to parse is fatal so we only need to actually report it there; all other instances can assume it's acceptable.clone
command is the first time the job file is parsed, so the error handling was expanded there to specifically report the parse error and fail the entire update process.While performing some manual tests, I discovered that the shape of the error objects returned by the end-to-end parser wasn't always correct, so I checked in the
dependabot/cli
repo to ensure the errors had the correct shape and added serialization tests for all error types to ensure this doesn't regress.