Skip to content

Catch async exceptions#20

Merged
kenodegard merged 4 commits into
mainfrom
async-exceptions
Feb 23, 2022
Merged

Catch async exceptions#20
kenodegard merged 4 commits into
mainfrom
async-exceptions

Conversation

@kenodegard

@kenodegard kenodegard commented Feb 22, 2022

Copy link
Copy Markdown
Contributor

Previously we weren't actually catching the top-level async exceptions. We were doing this:

try {
    cli()
} catch (err) {
    if (err instanceof Error) setFailed(err)
    else throw err
}

But instead needed this:

cli().catch(err => {
    if (err instanceof Error) setFailed(err)
    else throw err
})

Nothing has functionally changed here we just catch the errors in a cleaner manner.

@kenodegard kenodegard mentioned this pull request Feb 22, 2022
@kenodegard kenodegard self-assigned this Feb 22, 2022
@kenodegard
kenodegard merged commit bfa3889 into main Feb 23, 2022
@kenodegard
kenodegard deleted the async-exceptions branch February 23, 2022 23:59
@github-actions github-actions Bot added the locked [bot] locked due to inactivity label Feb 24, 2023
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked [bot] locked due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants