Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

View lookup should return something at least #1065

Closed
wants to merge 1 commit into from

2 participants

@gsf
gsf commented

Even if the path doesn't exist it's better for the lookup
method to return the last path checked. Without a return
value, if one attempts to render a path that doesn't
exist one gets "TypeError: Bad argument" because the
first param for fs.readFile is undefined. If the path is
returned one gets the more helpful "Error: ENOENT, no
such file or directory" along with the string for the
path.

@gsf gsf View lookup should return something at least
Even if the path doesn't exist it's better for the lookup
method to return the last path checked. Without a return
value, if one attempts to render a path that doesn't
exist one gets "TypeError: Bad argument" because the
first param for fs.readFile is undefined. If the path is
returned one gets the more helpful "Error: ENOENT, no
such file or directory" along with the string for the
path.
fd5127e
@tj tj closed this in 04d43d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2012
  1. @gsf

    View lookup should return something at least

    gsf authored
    Even if the path doesn't exist it's better for the lookup
    method to return the last path checked. Without a return
    value, if one attempts to render a path that doesn't
    exist one gets "TypeError: Bad argument" because the
    first param for fs.readFile is undefined. If the path is
    returned one gets the more helpful "Error: ENOENT, no
    such file or directory" along with the string for the
    path.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +1 −2  lib/view.js
View
3  lib/view.js
@@ -66,8 +66,7 @@ View.prototype.lookup = function(path){
if (exists(path)) return path;
// <path>/index.<engine>
- path = join(dirname(path), basename(path, ext), 'index' + ext);
- if (exists(path)) return path;
+ return join(dirname(path), basename(path, ext), 'index' + ext);
};
/**
Something went wrong with that request. Please try again.