fix: check if async error has a stack (#4017)

This commit is contained in:
Joel Einbinder 2019-03-04 17:32:54 -08:00 committed by Andrey Lushnikov
parent 9db09fe7e9
commit 02b2451db5
2 changed files with 2 additions and 2 deletions

View File

@ -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;
});

View File

@ -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;
});