Skip to content

Commit

Permalink
fix: check if async error has a stack (#4017)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelEinbinder authored and aslushnikov committed Mar 5, 2019
1 parent 9db09fe commit 02b2451
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion experimental/puppeteer-firefox/lib/helper.js
Expand Up @@ -32,7 +32,7 @@ class Helper {
return method.call(this, ...args).catch(e => {
const stack = syncStack.stack.substring(syncStack.stack.indexOf('\n') + 1);
const clientStack = stack.substring(stack.indexOf('\n'));
if (!e.stack.includes(clientStack))
if (e instanceof Error && e.stack && !e.stack.includes(clientStack))
e.stack += '\n -- ASYNC --\n' + stack;
throw e;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Expand Up @@ -109,7 +109,7 @@ class Helper {
return method.call(this, ...args).catch(e => {
const stack = syncStack.stack.substring(syncStack.stack.indexOf('\n') + 1);
const clientStack = stack.substring(stack.indexOf('\n'));
if (!e.stack.includes(clientStack))
if (e instanceof Error && e.stack && !e.stack.includes(clientStack))
e.stack += '\n -- ASYNC --\n' + stack;
throw e;
});
Expand Down

0 comments on commit 02b2451

Please sign in to comment.