Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More readable error message for invalid queries block and invalid query-filters block #1208

Merged
merged 5 commits into from Aug 23, 2022

Conversation

aeisenberg
Copy link
Contributor

Query-filters block:

Throws a more coherent error message when the query-filters block is not an array.

Queries block:

When someone creates an invalid queries entry in the codeql config
file, like this:

queries:
  - foo.ql

The error message is confusing, looking like this:

  Error: Cannot use 'in' operator to search for 'uses' in ql/ql/src
  TypeError: Cannot use 'in' operator to search for 'uses' in ql/ql/src
      at loadConfig (/home/runner/work/_actions/github/codeql-action/71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca/lib/config-utils.js:577:41)

With this change, the error message is more comprehensible:

queries must be an array, with each entry having a 'uses' property

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

When someone creates an invalid `queries` entry in the codeql config
file, like this:

```
queries:
  - foo.ql
```

THe error message is confusing, looking like this:

```
  Error: Cannot use 'in' operator to search for 'uses' in ql/ql/src
  TypeError: Cannot use 'in' operator to search for 'uses' in ql/ql/src
      at loadConfig (/home/runner/work/_actions/github/codeql-action/71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca/lib/config-utils.js:577:41)
```

With this change, the error message is more comprehensible:

`queries must be an array, with each entry having a 'uses' property`
Handle other cases where the config is invalid.
@aeisenberg aeisenberg requested a review from a team as a code owner August 23, 2022 16:28
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

LGTM

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Henry Mercer <henrymercer@github.com>
@aeisenberg aeisenberg merged commit 1cd5043 into main Aug 23, 2022
@aeisenberg aeisenberg deleted the aeisenberg/better-error-message branch August 23, 2022 18:29
@github-actions github-actions bot mentioned this pull request Aug 25, 2022
6 tasks
@aeisenberg aeisenberg changed the title More readable error message for invalid queries block and invalid query-filters blocl More readable error message for invalid queries block and invalid query-filters block Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants