function serializeError
Since 0.1.0
serializeError(value: unknown): SerializedError

Serializes any thrown value to a plain, serializable object.

An Error yields { name, message, stack?, cause?, classifiers?, errors? } with the cause chain followed to a bounded depth. Safe scalar driver classifiers are copied from a fixed allowlist; AggregateError members are copied under bounded width and total-node budgets. A non-Error value (a string, a number, a plain object) yields { name: 'Error', message: <stringified> } — the same shape, so a caller can always read name and message without narrowing.

Parameters

value: unknown

The thrown value

Return Type

A plain, serializable representation

Usage

import { serializeError } from "common/src/index.ts";