Skip to content

Commit

Permalink
fix: handle error in catch (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
damcou committed Sep 16, 2021
1 parent 3a0e21a commit 2fc63bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ async function addComment(crawlerId: string): Promise<void> {
body: message,
});
} catch (error) {
core.setFailed(error.message);
let errorMessage = 'An unexpected error happened.';

if (error instanceof Error) {
errorMessage = error.message;
} else {
console.log(error);
}

core.setFailed(errorMessage);
}
}

Expand Down

0 comments on commit 2fc63bb

Please sign in to comment.