import type { IndustryType, SDK } from '@iota-big3/sdk-core'; import { SDKError } from '@iota-big3/sdk-types'; import type { ErrorRequestHandler, NextFunction, Request, Response } from 'express'; import type { FastifyInstance } from 'fastify'; export interface ServiceMetadata { name: string; tribe?: string; industry?: IndustryType; version?: string; environment?: string; sdk?: SDK; } export interface ErrorResponse { error: { code: string; message: string; service: string; industry?: IndustryType; timestamp: string; details?: Record; suggestions?: string[]; requestId?: string; }; } export interface ErrorCodeMap { [key: string]: number; } export interface ErrorMiddlewareConfig { enableStackTrace?: boolean; customFormatter?: (error: Error, req: Request) => ErrorResponse; errorCodes?: Record; industrySpecific?: boolean; } export interface ErrorMiddleware extends ErrorRequestHandler { express: ErrorRequestHandler; fastify: (fastify: FastifyInstance) => Promise; } export declare function createErrorMiddleware(metadata: ServiceMetadata, options?: { enableStackTrace?: boolean; errorCodeMap?: ErrorCodeMap; customFormatter?: (error: any, req: Request) => ErrorResponse; }): ErrorMiddleware; export declare function setupGlobalErrorHandlers(metadata: ServiceMetadata): void; export declare function asyncHandler(fn: (req: T, res: Response, next: NextFunction) => Promise): (req: T, res: Response, next: NextFunction) => void; export declare function createValidationError(validationError: { details?: Array<{ message: string; path: string; }>; message?: string; }): SDKError; export declare function createPhilosophyError(message: string, impact: string, industry?: IndustryType): SDKError; export declare const errorMiddleware: typeof createErrorMiddleware; export default createErrorMiddleware; //# sourceMappingURL=error-middleware.d.ts.map