Skip to content

Commit 3fbd63a

Browse files
committed
Check for presence of 'stack' property, otherwise use message
1 parent 6cca198 commit 3fbd63a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ function _checkAccelerator(accelerator) {
2929
if (!isAccelerator(accelerator)) {
3030
const w = {};
3131
Error.captureStackTrace(w);
32+
const stack = w.stack ? w.stack.split('\n').slice(4).join('\n') : w.message;
3233
const msg = `
3334
WARNING: ${accelerator} is not a valid accelerator.
3435
35-
${w.stack
36-
.split('\n')
37-
.slice(4)
38-
.join('\n')}
36+
${stack}
3937
`;
4038
console.error(msg);
4139
}

0 commit comments

Comments
 (0)