Serialize an Error object to a JSON-compatible format.
The function extracts standard properties like name, message, stack, and cause, as well as any enumerable own properties of the error object.
name
message
stack
cause
If the error is an AggregateError, it also serializes the errors property.
errors
The Error object to serialize.
Optional
An optional replacer function to customize the serialization of values.
A JSON representation of the error.
Serialize an Error object to a JSON-compatible format.
The function extracts standard properties like
name
,message
,stack
, andcause
, as well as any enumerable own properties of the error object.If the error is an AggregateError, it also serializes the
errors
property.