Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bind SNSProcessor.next so that it's callback-able, and use that inste…

…ad of triggering an error, preferring instead to capture the errors at the end.
  • Loading branch information...
commit 05309d0925e9c433fd0ca39b5fab127fce3ec465 1 parent 97dd1f3
isaacs authored
2  lib/auto-index.js
View
@@ -10,7 +10,7 @@ exports.autoIndex = function autoIndex () {
Lang = require("./utils/lang");
posix.stat(dir)
- .addErrback(self.error(404, "Not found: "+dir))
+ .addErrback(self.next)
.addCallback(function (stat) {
if (!stat.isDirectory()) return self.next();
posix.readdir(dir)
4 lib/core.js
View
@@ -50,6 +50,10 @@ process.mixin(SNS.prototype, {
function SNSProcessor (server, req, res) {
var p = server.processors.pop() || this;
+ // bind p.next so I can pass it to callbacks, etc.
+ if (p.next === SNSProcessor.prototype.next) {
+ p.next = function () { return p.__proto__.next.call(p) };
+ }
process.mixin(p, {
server : server,
req : req,
2  lib/directory-index.js
View
@@ -12,7 +12,7 @@ exports.directoryIndex = function directoryIndex () {
i = 0,
indexFile = '';
posix.stat(file)
- .addErrback(function () { return self.next() })
+ .addErrback(self.next)
.addCallback(function lookForIndex (stat) {
// if it exists, and isn't a dir, then make that our place, and move on.
2  lib/file-server.js
View
@@ -11,7 +11,7 @@ exports.fileServer = function fileServer () {
self = this;
posix.stat(file)
- .addErrback(self.error(404, "Not found: "+file))
+ .addErrback(self.next)
.addCallback(function openAndSend (stat) {
if (stat.isDirectory()) return self.next();
posix.open(file, process.O_RDONLY, 0666)
Please sign in to comment.
Something went wrong with that request. Please try again.