Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.