@gati-framework/runtime
Version:
Gati runtime execution engine for running handler-based applications
28 lines • 1.18 kB
TypeScript
/**
* @module runtime/handler-engine
* @description Handler execution engine with error handling
*/
import type { Handler, HandlerExecutionOptions, Request, Response, GlobalContext, LocalContext } from './types/index.js';
/**
* Execute a handler function with the provided context
*
* @param handler - The handler function to execute
* @param req - HTTP request object
* @param res - HTTP response object
* @param gctx - Global context (shared resources)
* @param lctx - Local context (request-scoped data)
* @param options - Execution options
* @returns Promise that resolves when handler completes
*
* @throws {HandlerError} If handler validation fails
* @throws {Error} If handler execution times out
* @throws {Error} If handler throws an error (when catchErrors is false)
*
* @example
* ```typescript
* const handler: Handler = (req, res) => res.json({ ok: true });
* await executeHandler(handler, req, res, gctx, lctx);
* ```
*/
export declare function executeHandler(handler: Handler, req: Request, res: Response, gctx: GlobalContext, lctx: LocalContext, options?: HandlerExecutionOptions): Promise<void>;
//# sourceMappingURL=handler-engine.d.ts.map