Skip to content

Commit

Permalink
fix(util): Don't call toString() on Error
Browse files Browse the repository at this point in the history
core.setFailed() accepts either a string or an Error and calls
toString() on the latter, so simply pass it the Error.
  • Loading branch information
Kurt-von-Laven committed Mar 31, 2023
1 parent 06f2943 commit 69b7926
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/post/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe("Util", (): void => {
expect(stdout).toBe("");
expect(core.info).toHaveBeenCalledTimes(1);
expect(core.error).not.toHaveBeenCalled();
expect(core.setFailed).lastCalledWith(error.toString());
expect(core.setFailed).lastCalledWith(error);
},
{
examples: [
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const execBashCommand = async (
info(stdout);
error(output.stderr);
} catch (error: any) {
setFailed(error.toString());
setFailed(error);
}
return stdout;
};
Expand Down

0 comments on commit 69b7926

Please sign in to comment.