UNPKG

@vfarcic/dot-ai

Version:

AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance

35 lines 1.3 kB
/** * Shared error response formatting for HTTP interfaces * * Provides consistent error response format across MCP server and REST API. */ import { ServerResponse } from 'node:http'; export interface ErrorResponseBody { success: false; error: { code: string; message: string; details?: unknown; }; } /** * Format an error response body in the standard REST API format. * * @param code - Error code (e.g., 'UNAUTHORIZED', 'INTERNAL_ERROR') * @param message - Human-readable error message * @param details - Optional additional details * @returns Formatted error response body */ export declare function formatErrorResponse(code: string, message: string, details?: unknown): ErrorResponseBody; /** * Send an error response with consistent formatting. * * @param res - HTTP server response * @param statusCode - HTTP status code * @param code - Error code * @param message - Human-readable error message * @param details - Optional additional details * @param headers - Optional additional HTTP headers (e.g., WWW-Authenticate) */ export declare function sendErrorResponse(res: ServerResponse, statusCode: number, code: string, message: string, details?: unknown, headers?: Record<string, string>): void; //# sourceMappingURL=error-response.d.ts.map