Permalink
Browse files

Revert "Added double-next reporting"

This reverts commit 4046ad0.
  • Loading branch information...
1 parent 9d78e88 commit 81d9f22c126357a848d6e9723c701000da675544 @tj tj committed Aug 26, 2011
Showing with 3 additions and 36 deletions.
  1. +3 −36 lib/http.js
View
@@ -133,7 +133,6 @@ Server.prototype.use = function(route, handle){
Server.prototype.handle = function(req, res, out) {
var writeHead = res.writeHead
, stack = this.stack
- , called = []
, removed = ''
, index = 0;
@@ -145,17 +144,6 @@ Server.prototype.handle = function(req, res, out) {
layer = stack[index++];
- // callback used to track
- // and report double next()
- function callback(err) {
- if (~called.indexOf(layer.handle)) {
- reportDoubleNext(layer.handle);
- } else {
- called.push(layer.handle);
- next(err);
- }
- }
-
// all done
if (!layer) {
// but wait! we have a parent
@@ -202,12 +190,12 @@ Server.prototype.handle = function(req, res, out) {
var arity = layer.handle.length;
if (err) {
if (arity === 4) {
- layer.handle(err, req, res, callback);
+ layer.handle(err, req, res, next);
} else {
next(err);
}
} else if (arity < 4) {
- layer.handle(req, res, callback);
+ layer.handle(req, res, next);
} else {
next();
}
@@ -221,25 +209,4 @@ Server.prototype.handle = function(req, res, out) {
}
}
next();
-};
-
-/**
- * Report that the given `fn` was invoked
- * more than once. This _is_ an error, and
- * should be fixed in your application, however
- * this logic prevents the user from seeing
- * how node handles it via more obscure
- * errors such as: "Error: Can't set headers after they are sent."
- *
- * @param {Function} fn
- * @api private
- */
-
-function reportDoubleNext(fn) {
- process.stderr.write('Error: the following middleware invoked next() more than once: ');
- if (fn.name) {
- console.error(fn.name + '()');
- } else {
- console.error('\n\n' + fn.toString() + '\n');
- }
-}
+};

0 comments on commit 81d9f22

Please sign in to comment.