Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

mongodb-js/errors

Repository files navigation

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

About

Helpers for handling errors from the MongoDB driver.

Resources

License

Stars

Watchers

Forks

Packages

No packages published