CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
/**
|
|
* Custom error types for Brainy operations
|
|
* Provides better error classification and handling
|
|
*/
|
|
export type BrainyErrorType = 'TIMEOUT' | 'NETWORK' | 'STORAGE' | 'NOT_FOUND' | 'RETRY_EXHAUSTED' | 'VALIDATION';
|
|
/**
|
|
* Custom error class for Brainy operations
|
|
* Provides error type classification and retry information
|
|
*/
|
|
export declare class BrainyError extends Error {
|
|
readonly type: BrainyErrorType;
|
|
readonly retryable: boolean;
|
|
readonly originalError?: Error;
|
|
readonly attemptNumber?: number;
|
|
readonly maxRetries?: number;
|
|
constructor(message: string, type: BrainyErrorType, retryable?: boolean, originalError?: Error, attemptNumber?: number, maxRetries?: number);
|
|
/**
|
|
* Create a timeout error
|
|
*/
|
|
static timeout(operation: string, timeoutMs: number, originalError?: Error): BrainyError;
|
|
/**
|
|
* Create a network error
|
|
*/
|
|
static network(message: string, originalError?: Error): BrainyError;
|
|
/**
|
|
* Create a storage error
|
|
*/
|
|
static storage(message: string, originalError?: Error): BrainyError;
|
|
/**
|
|
* Create a not found error
|
|
*/
|
|
static notFound(resource: string): BrainyError;
|
|
/**
|
|
* Create a retry exhausted error
|
|
*/
|
|
static retryExhausted(operation: string, maxRetries: number, lastError?: Error): BrainyError;
|
|
/**
|
|
* Create a validation error
|
|
*/
|
|
static validation(parameter: string, constraint: string, value?: any): BrainyError;
|
|
/**
|
|
* Check if an error is retryable
|
|
*/
|
|
static isRetryable(error: Error): boolean;
|
|
/**
|
|
* Convert a generic error to a BrainyError with appropriate classification
|
|
*/
|
|
static fromError(error: Error, operation?: string): BrainyError;
|
|
}
|