/** * Typed error classes for the brightchain database engine. * * Provides MongoDB-compatible error names and structured properties * so consumers can catch and classify errors programmatically. */ import type { ValidationFieldError } from '../interfaces/storage/documentTypes'; export type { ValidationFieldError }; /** * Base class for all brightchain-db errors. */ export declare class BrightDbError extends Error { /** Numeric error code (MongoDB-style) */ readonly code: number; constructor(message: string, code: number); } /** * Thrown when a document is not found by _id. */ export declare class DocumentNotFoundError extends BrightDbError { readonly documentId: string; readonly collection: string; constructor(collection: string, documentId: string); } /** * Thrown when a unique index constraint is violated. * (Re-exported from indexing.ts — use `DuplicateKeyError` from there for the canonical class.) */ /** * Thrown when a document fails schema validation. */ export declare class ValidationError extends BrightDbError { /** Field-level validation failures */ readonly validationErrors: ValidationFieldError[]; readonly collection: string; constructor(collection: string, errors: ValidationFieldError[]); } /** * Thrown when a transaction operation is invalid (e.g. commit without active txn). */ export declare class TransactionError extends BrightDbError { readonly sessionId?: string; constructor(message: string, sessionId?: string); } /** * Thrown when an index operation fails. */ export declare class IndexError extends BrightDbError { readonly indexName?: string; constructor(message: string, indexName?: string); } /** * Thrown when a write concern cannot be satisfied. */ export declare class WriteConcernError extends BrightDbError { readonly writeConcern: WriteConcernSpec; constructor(message: string, writeConcern: WriteConcernSpec); } /** Write concern specification */ export interface WriteConcernSpec { /** Number of acknowledgments required (1 = primary only, 'majority' = majority) */ w?: number | 'majority'; /** Timeout in ms for write concern acknowledgment */ wtimeoutMS?: number; /** Whether to wait for journal sync */ journal?: boolean; } /** * Thrown when one or more operations in a bulk write fail. */ export declare class BulkWriteError extends BrightDbError { /** The individual write errors indexed by operation position */ readonly writeErrors: BulkWriteOperationError[]; /** Count of operations that succeeded */ readonly successCount: number; constructor(writeErrors: BulkWriteOperationError[], successCount: number); } export interface BulkWriteOperationError { index: number; code: number; message: string; } //# sourceMappingURL=errors.d.ts.map