Skip to content

roughculture/qfail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');
}

About

Automate async error handling in HTTP request handlers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published