API reference › @evolu/common › Error › UnknownError

Defined in: packages/common/src/Error.ts:25

A wrapper for unknown errors caught at runtime.

When catching errors from unsafe code (third-party libraries, worker boundaries, etc.), we wrap them in UnknownError so they can be used in union types and distinguished from other error types.

The error property contains error details (including message, stack, and cause if available), a string, or a fallback value.

Use createUnknownError to create instances. It turns an Error into a plain object, so the error can be posted between workers, for example in sync state, with its message and stack.

Extends

Properties

error

error: unknown;

Inherited from

InferType.error;

type

type: "UnknownError";

Inherited from

InferType.type;