You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mongodb-js-errors

Package Overview
Dependencies
Maintainers
46
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-js-errors

Helpers for handling errors from the MongoDB driver.

0.5.0
latest
Source
npmnpm
Version published
Weekly downloads
54
-85.08%
Maintainers
46
Weekly downloads
 
Created
Source

mongodb-errors travis npm

Helpers for handling errors from the MongoDB driver.

Example

var express = require('express');
var app = module.exports = express();

app.use(require('mongodb-js-errors/express'));
app.use(function(err, req, res) {
  var payload = err.output.payload;
  res.format({
    text: function() {
      res.status(err.output.statusCode).send(payload.message);
    },
    json: function() {
      res.status(err.output.statusCode).send(payload);
    }
  });
});

License

Apache 2.0

FAQs

Package last updated on 15 Jan 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