Skip to content

Commit d63c418

Browse files
committed
Improve error handle
1 parent a085b0d commit d63c418

File tree

1 file changed

+10
-1
lines changed
  • hugoalh.GitHubActionsToolkit/module/nodejs-wrapper/lib

1 file changed

+10
-1
lines changed

hugoalh.GitHubActionsToolkit/module/nodejs-wrapper/lib/main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ function base64ToUTF8(item) {
99
return Buffer.from(item, "base64").toString("utf8");
1010
}
1111
function errorHandle(reason) {
12-
console.error(reason?.message ?? reason);
12+
let message;
13+
if (typeof reason.message === "undefined") {
14+
message = reason;
15+
} else {
16+
message = reason.message;
17+
if (typeof reason.stack === "undefined") {
18+
message = `\n${reason.stack}`
19+
}
20+
}
21+
console.error(message);
1322
return process.exit(1);
1423
}
1524
function resultHandle(result) {

0 commit comments

Comments
 (0)