Socket
Socket
Sign inDemoInstall

mali-error-mapper

Package Overview
Dependencies
39
Maintainers
9
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mali-error-mapper

Error mapper for Mali applications


Version published
Weekly downloads
1.3K
decreased by-16.65%
Maintainers
9
Created
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 for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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