Skip to main content

core.serializeerror

Home > @medplum/core > serializeError

serializeError() function

Serializes an Error object into a plain object, including nested causes and custom properties.

Signature:

export declare function serializeError(error: Error, depth?: number, maxDepth?: number): Record<string, any>;

Parameters

Parameter

Type

Description

error

Error

The error to serialize.

depth

number

(Optional) The current depth of recursion.

maxDepth

number

(Optional) The maximum depth of recursion.

Returns:

Record<string, any>

A serialized representation of the error.