CircularErrorCause

SerializationFeature.CircularErrorCause

Allow Errors to self-reference in their cause.

Support for serializing errors with cause objects referencing the error was added to v15 in Nov 2023

Versions before this are not able to de-serialize errors linking to themselves in their cause. Also, versions before this change serialize error stack after the cause, whereas versions after this serialize the stack before the cause and are not able to handle the previous stack encoding.

v8serialize is able to support reading both formats ourselves, despite V8 not being able to read errors written before this change (despite the format remaining at 15). The new error layout can be read by V8 versions before the change.

v8serialize must avoid writing errors with self-referencing cause values unless this feature is enabled, and the encoder raises a IllegalCyclicReferenceV8SerializeError if this happens.