https://github.com/danielstjules/oops.js
https://github.com/danielstjules/oops.js
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danielstjules/oops.js
- Owner: danielstjules
- License: mit
- Created: 2014-08-17T06:55:30.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-15T02:59:40.000Z (almost 12 years ago)
- Last Synced: 2025-01-31T10:22:24.506Z (over 1 year ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Better error pages for Node.js. A collection of middleware for better error
handling and reporting with Express 3/4 and Koa. Also compatible with other
connect-style frameworks.
## Overview
The library exposes middleware specific to both Express as well as Koa.
Express middleware:
* `oops.wrapRequests`: Binds all request/response pairs to domains. This
localizes any uncaught exceptions thrown during a request life-cycle to the
given request.
* `oops.express`: Installs an error handler and error page
Koa middleware:
* `oops.koa`: Installs an error handler and error page
It also exposes a function for installing an error dashboard:
* `oops.installDashboard`: Install the oops dashboard in an express or koa app
## Express 3.x and 4.x
Basic development setup:
```
var oops = require('oops.js');
if (app.settings.env === 'development') {
app.use(oops.express());
}
```
Using a redis client to track errors among multiple node instances, as well
as wrapRequests and the dashboard.
```
var redis = require('redis');
var client = redis.createClient();
var oops = require('oops.js');
app.use(oops.wrapRequests);
if (app.settings.env === 'development') {
app.use(oops.express());
oops.installDashboard(app, {redis: client});
}
```