import type { Middleware } from '@chubbyts/chubbyts-http-types/dist/middleware';
import type { ResponseFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';
import { createErrorMiddleware } from '@chubbyts/chubbyts-framework/dist/middleware/error-middleware';

const responseFactory: ResponseFactory = ...;

const errorMiddleware: Middleware = createErrorMiddleware(responseFactory);
  • Parameters

    • responseFactory: ResponseFactory
    • debug: boolean = false
    • logger: Logger = ...
    • mapToHttpError: MapToHttpError = defaultMapToHttpError

    Returns Middleware