## serializeError() function

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

**Signature:**
```typescript
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.

- [serializeError() function](/content/docs/sdk/core.serializeerror#serializeerror-function/index.html)
- [Parameters](/content/docs/sdk/core.serializeerror#parameters/index.html)
