FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update code so "github/no-then" passes by ericcornelissen · Pull Request #321 · github/codeql-action · GitHub

Update code so "github/no-then" passes - #321

Merged
robertbrignull merged 3 commits into
github:mainfrom
ericcornelissen:eslint/github-no-then
Nov 26, 2020
Merged

robertbrignull merged 3 commits into
github:mainfrom
ericcornelissen:eslint/github-no-then

Conversation

ericcornelissen commented Nov 25, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

Merge / deployment checklist

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

Closes #200 by wrapping the calls to run()-like functions that had .catch appended (possibly to avoid warnings by the @typescript/no-floating-promises rule?) in functions that catch potential errors using a try-catch statement.

The void in front of the runWrapper function is necessary to avoid warnings by the @typescript/no-floating-promises rule.

ericcornelissen marked this pull request as ready for review November 25, 2020 22:08

Copy link
Copy Markdown
Contributor

This area is surprisingly tricky. The problem is that we're going from non-async code into async code and we need to catch any errors that happen within. Async stuff is just syntactic sugar around promises so that's why we call the async run function non-async and use catch explicitly. You can't use async at the top level in a file, or at least if you do it doesn't behave as you'd want it to.

Your solution here looks like it should work, but I'd like to test it to make sure. If errors are still reported correctly then LGTM.

Copy link
Copy Markdown
Contributor

Ok, I've tried it out (didn't take long) and the error handling is working exactly as it was before, so I'm happy with this and it gets us one eslint rule closer.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESLint transition: update code so "github/no-then" passes

2 participants


Back | FazBrowse Home | New Git URL