Skip to content

Commit

Permalink
Never serialize .cause when an Error
Browse files Browse the repository at this point in the history
Instead rely on its content being appended to the message and the stack.

This is an alternative fix to pinojs#94, replacing pinojs#105 and pinojs#108 + makes pinojs#109 not needed
  • Loading branch information
voxpelli committed Jun 13, 2022
1 parent 23f62f2 commit 8fd1809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/err.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ function errSerializer (err) {
for (const key in err) {
if (_err[key] === undefined) {
const val = err[key]
if (val instanceof Error && key !== 'cause') {
if (val instanceof Error) {
/* eslint-disable no-prototype-builtins */
if (!val.hasOwnProperty(seen)) {
if (key !== 'cause' && !val.hasOwnProperty(seen)) {
_err[key] = errSerializer(val)
}
} else {
Expand Down

0 comments on commit 8fd1809

Please sign in to comment.