Put API/networking errors on another error code #857
Merged
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.
Separate out API errors into its own error code. The intention is to avoid lumping everything in error 127, since it is reserved for general errors not actionable by the user.
Errors related to the API should be separate as they are actionable by the user (e.g. the CI it's running on has no access to the internet), or our API is timing out, so they should try again...etc.
Another motivation is that currently because API errors are mixed in with general errors, it's not clear to the user what caused the osv-scanner GitHub action to fail, since we specifically ignore general errors and set the exit code to 0 in the GitHub action, as this could be caused by failing to parse a specific lockfile. This leads to situations like: https://github.com/google/osv.dev/actions/runs/8243615203/job/22544495994?pr=2048 , where it's unclear what the actual error is (it is hiding under
Run Scanner For Existing Code
step, which is a check).This PR also clarifies the error wording to make it clear which query caused the error.
TODO: (In followup PRs)