Skip to content

jsonMakeErrorReplacerFunction

jsonMakeErrorReplacerFunction(replacer?): JsonReplacerFunction

Defined in: packages/core/src/json/replacers/error.ts:37

Create a JSON replacer function that converts Error objects into plain objects containing their non-enumerable properties (name, message, stack, cause, etc.) along with any enumerable properties.

This function can be used as a base replacer to ensure that Error objects are properly serialized during JSON serialization, and can be combined with a user-defined replacer for additional customization.

JsonReplacer

An optional user-defined replacer (function or property list) to apply after the Error replacer.

JsonReplacerFunction

A JSON replacer function that handles Error objects and applies the user-defined replacer if provided.