Skip to content

Commit

Permalink
improve captured message of Error object (rrweb-io#835)
Browse files Browse the repository at this point in the history
try to fix this problem:
rrweb-io#814 (comment)
  • Loading branch information
YunFeng0817 authored Feb 17, 2022
1 parent 1935bf6 commit 167f0fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/rrweb/src/plugins/console/record/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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\\\\\\"\\"
]
}
}
Expand Down

0 comments on commit 167f0fa

Please sign in to comment.