/** * Base error class for all BrightChain errors. * * This class provides a consistent error structure across the BrightChain library, * including error type, message, context, and cause tracking. * * @remarks * - All BrightChain-specific errors should extend this class * - The `type` property identifies the error category * - The `context` property provides additional debugging information * - The `cause` property preserves the original error when wrapping * * @example * ```typescript * class MyServiceError extends BrightChainError { * constructor(message: string, context?: Record) { * super('MyService', message, context); * } * } * * throw new MyServiceError('Operation failed', { operationId: '123' }); * ``` * * @see Requirements 4.1, 4.2, 4.3, 4.4, 13.1, 13.2, 13.3, 13.4, 13.6 */ export declare abstract class BrightChainError extends Error { readonly type: string; readonly context?: Record | undefined; readonly cause?: Error; /** * Creates a new BrightChainError instance. * * @param type - The error type/category identifier * @param message - Human-readable error message * @param context - Optional additional context for debugging * @param cause - Optional original error that caused this error */ constructor(type: string, message: string, context?: Record | undefined, cause?: Error); /** * Get full error details including context as a JSON-serializable object. * * @returns An object containing all error details * * @example * ```typescript * try { * // ... operation that throws * } catch { * if (isBrightChainError(error)) { * console.log(JSON.stringify(error.toJSON(), null, 2)); * } * } * ``` */ toJSON(): object; } /** * Type guard to check if a value is a BrightChainError instance. * * @param error - The value to check * @returns true if the value is a BrightChainError instance * * @example * ```typescript * try { * // ... operation that might throw * } catch { * if (isBrightChainError(error)) { * console.error(`${error.type}: ${error.message}`, error.context); * } * } * ``` * * @see Requirement 4.5 */ export declare function isBrightChainError(error: unknown): error is BrightChainError; //# sourceMappingURL=brightChainError.d.ts.map