Describe the bug
Passing an error directly into core.setFailed fails with random error ((s || "").replace is not a function).
To Reproduce
Steps to reproduce the behavior:
- Create failing action (example below)
- Ensure
core.setFailed(e); instead of core.setFailed(`${e}`);
- Run GitHub Action
Expected behavior
It to fail with an error message of ERROR as opposed to a type error. Both core.setFailed(e); and core.setFailed(`${e}`); should produce the same result, they aren't currently.
Example Code
const core = require("@actions/core");
(async function (){
try {
throw new Error("ERROR");
} catch (e) {
core.setFailed(e);
}
})();
Current behavior
(node:2682) UnhandledPromiseRejectionWarning: TypeError: (s || "").replace is not a function
10
at escapeData (/.github/actions/installnpm/node_modules/@actions/core/lib/command.js:66:10)
11
at Command.toString (/.github/actions/installnpm/node_modules/@actions/core/lib/command.js:60:35)
12
at issueCommand (/.github/actions/installnpm/node_modules/@actions/core/lib/command.js:23:30)
13
at Object.issue (/.github/actions/installnpm/node_modules/@actions/core/lib/command.js:27:5)
14
at error (/.github/actions/installnpm/node_modules/@actions/core/lib/core.js:127:15)
15
at Object.setFailed (/.github/actions/installnpm/node_modules/@actions/core/lib/core.js:101:5)
16
at /.github/actions/installnpm/main.js:13:8
17
at processTicksAndRejections (internal/process/task_queues.js:93:5)
18
(node:2682) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
19
Other Notes
- The bug was originally found in a failing
await exec.exec command. I'm pretty confident that the code above will reproduce the issue, but if not, try doing it with a failing await exec.exec command.
Describe the bug
Passing an error directly into
core.setFailedfails with random error ((s || "").replace is not a function).To Reproduce
Steps to reproduce the behavior:
core.setFailed(e);instead ofcore.setFailed(`${e}`);Expected behavior
It to fail with an error message of
ERRORas opposed to a type error. Bothcore.setFailed(e);andcore.setFailed(`${e}`);should produce the same result, they aren't currently.Example Code
Current behavior
Other Notes
await exec.execcommand. I'm pretty confident that the code above will reproduce the issue, but if not, try doing it with a failingawait exec.execcommand.