Function: ErrorHandlerMiddleware()
Function: ErrorHandlerMiddleware()
function ErrorHandlerMiddleware(context, next): Promise<IBlueprint>;
Middleware to add error handlers to the blueprint.
This middleware identifies modules marked as error handlers and adds them to the blueprint's list of kernel.errorhandlers.
Note: User defined error handlers take precedence over built-in and third-party error handlers. So the users can override the default error handlers.
Parameters
context
BlueprintContext
<IBlueprint
, ClassType
>
The configuration context containing modules and blueprint.
next
NextPipe
<BlueprintContext
<IBlueprint
, ClassType
>, IBlueprint
>
The next function in the pipeline.
Returns
Promise
<IBlueprint
>
The updated blueprint.
Example
ErrorHandlerMiddleware({ modules, blueprint }, next);