0.0.1 • Published 10 years ago

qfail v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

qfail

Automate async error handling in HTTP request handlers.

Install

It's just an npm package, so use npm.

$ npm install --save qfail

Usage

qfail provides a function for wrapping existing request handlers (like connect middleware, or the connect/express apps themselves) inside 'domains' for uniformly handling unexpected errors on a per-request basis. It also performs finalhandler-style error handling by default and provides an interface for closing the HTTP server and disconnecting the cluster-worker when an error occurs (for use in clusters with fault-tolerance).

var qfail = require('qfail');
var http = require('http');

var server = http.createServer(qfail(myHandler));

server.listen(8000);

function myHandler(req, res) {
  throw new Error('I get caught by the handler domain');
}