/** * memory-journal-mcp — Base Error Classes * * Enriched error hierarchy with category, suggestion, recoverable, * and toResponse() for structured error handling. */ import type { ErrorCategory, ErrorResponse } from './error-types.js'; interface ErrorOptions { /** Actionable suggestion for resolving the error */ suggestion?: string | undefined; /** Whether the operation can be retried */ recoverable?: boolean | undefined; /** Additional structured context */ details?: Record | undefined; /** Original cause error */ cause?: unknown; } /** * Base error class for all memory-journal-mcp errors. * Provides structured error responses with category, suggestion, * and recoverable fields for agent-friendly error handling. * * Auto-refinement: when constructed with a generic code (e.g., QUERY_FAILED) * and the message matches a known pattern from ERROR_SUGGESTIONS, the code * is refined to a more specific value (e.g., TABLE_NOT_FOUND). */ export declare class MemoryJournalMcpError extends Error { /** Module-prefixed error code */ readonly code: string; /** Error category for programmatic handling */ readonly category: ErrorCategory; /** Actionable suggestion for resolving the error */ readonly suggestion?: string | undefined; /** Whether the operation can be retried */ readonly recoverable: boolean; /** Additional structured context */ readonly details?: Record | undefined; constructor(message: string, code: string, category: ErrorCategory, options?: ErrorOptions); /** * Convert to a structured ErrorResponse for tool responses. */ toResponse(): ErrorResponse; } /** * Database connection or initialization error */ export declare class ConnectionError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * Query execution error */ export declare class QueryError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * Input validation error (bad parameters, schema violations) */ export declare class ValidationError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * Optimistic concurrency version conflict */ export declare class ConflictError extends MemoryJournalMcpError { readonly currentState: Record; constructor(message: string, currentState: Record); } /** * Resource not found error */ export declare class ResourceNotFoundError extends MemoryJournalMcpError { constructor(resourceType: string, identifier: string); } /** * Server or service configuration error */ export declare class ConfigurationError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * File or database permission error */ export declare class PermissionError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * Authorization error (e.g. RBAC denial) */ export declare class AuthorizationError extends MemoryJournalMcpError { constructor(message: string, details?: Record); } /** * Aggregation of multiple errors in a multi-step operation. */ export declare class AggregateMcpError extends MemoryJournalMcpError { readonly errors: { message: string; [key: string]: unknown; }[]; constructor(message: string, errors: { message: string; [key: string]: unknown; }[], details?: Record); toResponse(): ErrorResponse; } export {}; //# sourceMappingURL=errors.d.ts.map