Browse files

Pass through to the next 'connect' layer on an ENOENT error (i.e. req…

…uested file does not exist).

This matches the behavior of the 'staticProvider' middleware in 'connect', and will also prevent unnecessary errors being spewed to the server's stderr, when it should really only respond with a 404.
  • Loading branch information...
1 parent bb34cff commit 40e8d379fea9e1bc6dd4c30173f7b4ce762e6860 @TooTallNate TooTallNate committed with Sep 22, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/wheat.js
View
5 lib/wheat.js
@@ -36,8 +36,9 @@ function addRoute(regex, renderer) {
function handleRoute(req, res, next, renderer, match) {
function callback(err, data) {
if (err) {
- next(err);
- return;
+ return err.errno === process.ENOENT
+ ? next()
+ : next(err);
}
res.writeHead(200, data.headers);
res.end(data.buffer);

0 comments on commit 40e8d37

Please sign in to comment.