Skip to content

Commit

Permalink
fix: Wrap an entrypoint by async to handle exceptions correctly (#363)
Browse files Browse the repository at this point in the history
* fix: add return type

Co-authored-by: Shohei Ueda <30958501+peaceiris@users.noreply.github.com>
  • Loading branch information
yutopp and peaceiris authored Jun 21, 2020
1 parent 998d851 commit 54af4c1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as core from '@actions/core';
import * as main from './main';

try {
main.run();
} catch (e) {
core.setFailed(`Action failed with error ${e}`);
}
(async (): Promise<void> => {
try {
await main.run();
} catch (e) {
core.setFailed(`Action failed with error ${e.message}`);
}
})();

0 comments on commit 54af4c1

Please sign in to comment.