class BaseError
extends Error

Base class for all custom errors in the application. Provides consistent error structure with error codes.

Constructors

new
BaseError(
message: string,
code: ErrorCode,
cause?: Error,
)

Creates a new BaseError

Properties

readonly
optional
cause: Error

Original error that caused this error

readonly
code: ErrorCode

Error code for categorization

readonly
timestamp: string

ISO timestamp when the error occurred

Methods

toJSON(): Record<string, unknown>

Returns a JSON-serializable representation of the error

Usage

import { BaseError } from ".";