Mali error mapper
Mali gRPC error mappers and middleware.
Middleware
This middleware maps all non GrpcError
errors to a GrpcError
formatted accordingly.
Status
Installation
Install the package via yarn
:
❯ yarn add mali-error-mapper
or via npm
:
❯ npm install mali-error-mapper --save
Usage
Using default mapping:
'use strict'; const errorMapperMiddleware = ;const app = ; app;
Using custom mappers:
'use strict'; const errorMapperMiddleware = ;const app = ;const mapper = { if !e instanceof MyError return; return body: code: 'foo' message: 'bar' status: 999 ; };; app;
License
MIT