UNPKG

@comake/skl-js-engine

Version:

Standard Knowledge Language Javascript Engine

67 lines 2.1 kB
"use strict"; /** * Custom error classes for better error handling in JSExecutor */ Object.defineProperty(exports, "__esModule", { value: true }); exports.AlreadyInitializedError = exports.NotInitializedError = exports.CodeExecutionError = exports.OutputParsingError = exports.ProcessSpawnError = exports.ExecutionTimeoutError = void 0; /** * Error thrown when code execution times out */ class ExecutionTimeoutError extends Error { constructor(timeout) { super(`Execution timed out after ${timeout}ms`); this.name = 'ExecutionTimeoutError'; } } exports.ExecutionTimeoutError = ExecutionTimeoutError; /** * Error thrown when the Deno process fails to spawn */ class ProcessSpawnError extends Error { constructor(originalError) { super(`Failed to spawn Deno process: ${originalError.message}`); this.name = 'ProcessSpawnError'; } } exports.ProcessSpawnError = ProcessSpawnError; /** * Error thrown when the executor output cannot be parsed */ class OutputParsingError extends Error { constructor(rawOutput, originalError) { super(`Failed to parse output: ${originalError.message}`); this.name = 'OutputParsingError'; } } exports.OutputParsingError = OutputParsingError; /** * Error thrown when code execution fails in general */ class CodeExecutionError extends Error { constructor(message) { super(`Failed to execute code: ${message}`); this.name = 'CodeExecutionError'; } } exports.CodeExecutionError = CodeExecutionError; /** * Error thrown when the JSExecutor is not initialized */ class NotInitializedError extends Error { constructor(message) { super(message); this.name = 'NotInitializedError'; } } exports.NotInitializedError = NotInitializedError; /** * Error thrown when the JSExecutor is already initialized */ class AlreadyInitializedError extends Error { constructor(message) { super(message); this.name = 'AlreadyInitializedError'; } } exports.AlreadyInitializedError = AlreadyInitializedError; //# sourceMappingURL=errors.js.map