Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
express-errors-handler
Advanced tools
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
npm install --save express-errors-handler
var express = require('express');
var app = express();
var eeh = require('express-errors-handler')
var errorMiddleware = eeh.middleware;
var promiseEnabledApi = require('./my-promise-enabled-api');
// A typical route using Promises
app.get('/a-typical-route', function(req, res, next) {
promiseEnabledApi.getSomeThings()
.then(function(someThings) {
res.render(someThings);
})
// Make sure to end all Promise chains with a `catch`
// that passes the error to the next middleware
.catch(next);
});
// A typical route with an upstream dependency
app.get('/a-typical-route', function(req, res, next) {
fetch('http://a.url.i-like')
.then(function(someThings) {
res.render(someThings);
})
// chosse what status to send when an upstream service errors
.catch(eeh.upstreamErrorHandler(404))
// Make sure to end all Promise chains with a `catch`
// that passes the error to the next middleware
.catch(next);
});
// Make sure the middleware is added after your routes otherwise you'll lose the errors
app.use(errorMiddleware);
NODE_ENV
- mode to operate in, can be either PRODUCTION
(sends bugs to aggregator) or any another value (shows bugs to user)RAVEN_URL
- URL to report bugs captured in productionSPLUNK_URL
- URL to send non critical or upstream bugs tooThis software is published by the Financial Times under the MIT license.
FAQs
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
The npm package express-errors-handler receives a total of 1 weekly downloads. As such, express-errors-handler popularity was classified as not popular.
We found that express-errors-handler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.