Fix error trying to trim a partial stack trace

This commit is contained in:
Zaid Abdulla committed 2018-03-19 23:17:39 -07:00
1 parent fb229897f7
commit bc8619e199
1 file changed
+4 -2
+4 -2
View File
@@ -285,9 +285,11 @@ function errorToFault(err) {
};
if (err.stack) {
fault.detail.stack = err.stack;
// Trim the stack trace at the self-executing anonymous wrapper function
let stackTrimIndex = err.stack.match(/\s+at\s[^\s]+\s+at\s[^\s]+\s\(vm\.js.+\)/).index;
fault.detail.stack = err.stack.slice(0, stackTrimIndex);
let stackTrimIndex = fault.detail.stack.match(/\s+at\s[^\s]+\s+at\s[^\s]+\s\(vm\.js.+\)/);
if (stackTrimIndex)
fault.detail.stack = fault.detail.stack.slice(0, stackTrimIndex.index);
}
return fault;