Skip to content
Browse files

Remove support of custom error handler

  • Loading branch information...
1 parent d0eaf53 commit de8c5cfdf453b52e1f90c4f95696968c1307b954 @baryshev committed Jan 2, 2013
Showing with 3 additions and 35 deletions.
  1. +0 −26 README.md
  2. +2 −8 lib/connect-domain.js
  3. +1 −1 package.json
View
26 README.md
@@ -8,8 +8,6 @@ Asynchronous error handler for Connect
# Usage
-## Passing asynchronous errors to default connect error handler
-
```js
var
connect = require('connect'),
@@ -34,28 +32,4 @@ var app = connect()
});
app.listen(3000);
-```
-
-## Custom error handler
-
-```js
-var
- connect = require('connect'),
- connectDomain = require('connect-domain');
-
-var app = connect()
- .use(connectDomain(function(err, req, res) {
- res.end(err.message);
- }))
- .use(function(req, res){
- setTimeout(function() {
- if (Math.random() > 0.5) {
- throw new Error('Error from timeout');
- } else {
- res.end('Hello from Connect!');
- }
- }, 1000);
- });
-
-app.listen(3000);
```
View
10 lib/connect-domain.js
@@ -2,21 +2,15 @@
'use strict';
var domain = require('domain');
- module.exports = function (handler) {
+ module.exports = function () {
return function domainMiddleware(req, res, next) {
var reqDomain = domain.create();
res.on('close', function () {
reqDomain.dispose();
});
- reqDomain.on('error', function (err) {
- if (typeof handler === 'function') {
- handler(err, req, res, next);
- } else {
- next(err);
- }
- });
+ reqDomain.on('error', next);
reqDomain.run(next);
};
View
2 package.json
@@ -1,6 +1,6 @@
{
"name" : "connect-domain",
- "version" : "0.3.1",
+ "version" : "0.4.0",
"description" : "Asynchronous error handler for Connect",
"keywords": [ "domain", "error", "connect" ],
"author" : "Vadim M. Baryshev <vadimbaryshev@gmail.com>",

0 comments on commit de8c5cf

Please sign in to comment.
Something went wrong with that request. Please try again.