Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mali-error-mapper

Package Overview
Dependencies
Maintainers
9
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mali-error-mapper

Error mapper for Mali applications

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-53.18%
Maintainers
9
Weekly downloads
 
Created
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

Package last updated on 24 Jul 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc