Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

mali-error-mapper

Package Overview
Dependencies
1
Maintainers
9
Versions
3
Issues
File Explorer

Advanced tools

mali-error-mapper

Error mapper for Mali applications

    2.0.0latest
    npm

Version published
Maintainers
9
Weekly downloads
982
decreased by-17.06%

Weekly downloads

Readme

Source

Mali error mapper

Mali gRPC error mappers and middleware.

Middleware

This middleware maps all non GrpcError errors to a GrpcError formatted accordingly.

Status

Build 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 = require('mali-error-mapper'); const app = new Mali(); app.use(errorMapperMiddleware());

Using custom mappers:

'use strict'; const errorMapperMiddleware = require('mali-error-mapper'); const app = new Mali(); const mapper = { map: e => { if (!(e instanceof MyError)) { return; } return { body: { code: 'foo', message: 'bar' }, status: 999 }; }; }; app.use(errorMiddleware([mapper]));

License

MIT

Keywords

FAQs

Last updated on 24 Jul 2020

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc