Permalink
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...
TooTallNate committed Sep 22, 2010
1 parent bb34cff commit f16848fea6ed2e1cb0c2e5a38afc0e2b2a4fb1aa
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/wheat.js
View
@@ -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 f16848f

Please sign in to comment.