improve captured message of Error object (#835)

try to fix this problem:
https://github.com/rrweb-io/rrweb/issues/814#issuecomment-1033735775
This commit is contained in:
Yun Feng
2022-02-17 17:12:07 +11:00
committed by GitHub
parent 1935bf606f
commit 167f0fa08d
2 changed files with 4 additions and 2 deletions

View File

@@ -137,7 +137,9 @@ export function stringify(
}
return value.nodeName;
} else if (value instanceof Error) {
return value.name + ': ' + value.message;
return value.stack
? value.stack + '\nEnd of stack for Error object'
: value.name + ': ' + value.message;
}
return value;
});

View File

@@ -7816,7 +7816,7 @@ exports[`record integration tests should record console messages 1`] = `
\\"__puppeteer_evaluation_script__:19:37\\"
],
\\"payload\\": [
\\"\\\\\\"TypeError: a message\\\\\\"\\"
\\"\\\\\\"TypeError: a message\\\\\\\\n at __puppeteer_evaluation_script__:19:41\\\\\\\\nEnd of stack for Error object\\\\\\"\\"
]
}
}