UNPKG

qnce-engine

Version:

Core QNCE (Quantum Narrative Convergence Engine) - Framework agnostic narrative engine with performance optimization

76 lines 2.58 kB
import { Choice } from './core'; import { ValidationResult } from './validation'; /** * Base class for all QNCE-specific errors */ export declare class QNCEError extends Error { readonly errorCode: string; readonly timestamp: number; readonly metadata?: Record<string, unknown>; constructor(message: string, errorCode: string, metadata?: Record<string, unknown>); } /** * Error thrown when navigation to a node fails * Used by goToNodeById() and related navigation methods */ export declare class QNCENavigationError extends QNCEError { readonly nodeId?: string; constructor(message: string, nodeId?: string, metadata?: Record<string, unknown>); } /** * Error thrown when choice validation fails * Provides detailed information about why the choice is invalid */ export declare class ChoiceValidationError extends QNCEError { readonly choice: Choice; readonly validationResult: ValidationResult; readonly availableChoices?: Choice[]; constructor(choice: Choice, validationResult: ValidationResult, availableChoices?: Choice[]); /** * Get a user-friendly error message with suggestions */ getUserFriendlyMessage(): string; /** * Get debugging information for developers */ getDebugInfo(): Record<string, unknown>; } /** * Error thrown when story data is invalid or corrupted */ export declare class StoryDataError extends QNCEError { readonly storyId?: string; constructor(message: string, storyId?: string, metadata?: Record<string, unknown>); } /** * Error thrown when engine state becomes inconsistent */ export declare class StateError extends QNCEError { readonly stateSnapshot?: Record<string, unknown>; constructor(message: string, stateSnapshot?: Record<string, unknown>); } /** * Utility function to check if an error is a QNCE error */ export declare function isQNCEError(error: unknown): error is QNCEError; /** * Utility function to check if an error is a choice validation error */ export declare function isChoiceValidationError(error: unknown): error is ChoiceValidationError; /** * Utility function to check if an error is a navigation error */ export declare function isNavigationError(error: unknown): error is QNCENavigationError; /** * Create a standardized error response for API consumers */ export declare function createErrorResponse(error: unknown): { success: false; error: { name: string; message: string; code?: string; metadata?: Record<string, unknown>; }; }; //# sourceMappingURL=errors.d.ts.map