
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 16 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.