SeyfertError
Base error type used by Seyfert. It supports optional machine-readable metadata and preserves the original cause when wrapping lower-level errors.
Signature
export declare class SeyfertError extends ErrorJSDoc
Examples
throw new SeyfertError('INVALID_TOKEN', {
metadata: { shardId: 0 },
});@remarksFor validation errors, prefer structured metadata (you can use {@link createValidationMetadata }) with: - `expected`: expected value or shape - `received`: received value - `receivedType`: optional primitive/runtime type
Properties
name: string;Error name used in logs and stack traces.
code: SeyfertErrorCode;Optional machine-readable error identifier.
metadata?: Record<string, unknown>;Optional contextual data attached to the error.
Methods
static is(error: unknown): error is SeyfertError;static is<C extends SeyfertErrorCode>(error: unknown, code: C): error is SeyfertError & { code: C;};constructorConstructorconstructor(code: SeyfertErrorCode, options?: { metadata?: Record<string, unknown>; cause?: unknown;});toJSON(): { name: string; message: string; code: SeyfertErrorCode; metadata: Record<string, unknown> | undefined; cause: unknown;};Serializes the error into a plain object.
Returns
Serializable error payload including name, message, code, metadata and cause.