From bfd9db90ddfb49b70395167fbe8f24036bf7342e Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Thu, 14 Feb 2019 17:01:06 -0800 Subject: [PATCH 1/2] fix: guard async stack trace error code --- lib/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper.js b/lib/helper.js index ee1055c70a4a0..f434707c4fae2 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -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; }); From 650eaa031e8f1fa3c64d14887df5890d69fd3b54 Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Wed, 20 Feb 2019 00:58:03 -0800 Subject: [PATCH 2/2] add to firefox --- experimental/puppeteer-firefox/lib/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/puppeteer-firefox/lib/helper.js b/experimental/puppeteer-firefox/lib/helper.js index 30d1b867be5bd..81dd61d6808c8 100644 --- a/experimental/puppeteer-firefox/lib/helper.js +++ b/experimental/puppeteer-firefox/lib/helper.js @@ -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; });