express-catch
Error propagation for express.js
This small utility wraps all express.js functions ensuring that errors thrown or promises rejected by callback functions are caught and propagated to the next handler.
Install
npm install --save express-catch # - or - yarn add express-catch
Usage example
const express = ;const wrapCatch = ; const server = ;const router = ; router; router; // Using `server` here! See notes.server; server;
Notes
- The given object is not modified
- The functionality is meant to be used with routing functions having the signature
(req, res, next)
- therefore, it does not work with error handlers, for example. Define them using the original server object.