mongodb-js-errors
Helpers for handling errors from the MongoDB driver.
Last updated 9 months ago by imlucas .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mongodb-js-errors 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.5.0                                ...           latest (9 months ago)

10 Versions

  • 0.5.0                                ...           9 months ago
  • 0.4.0                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.1                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |