Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error event handling w/ invalid path #15

Closed
jhouchard opened this Issue · 0 comments

2 participants

@jhouchard

Hi all,

In index.js around line 84 is the code below the dashed line. It seems like there is a missing else below the "if (err)" block on the line "if(s.isDirectory())". i.e. is should be "else if(s.isDirectory())". I tried to handle the error event in my code but because the else is not there, an error occurs because s is undefined when starting finder w/ an invalid path.

Adding an else fixes my async application of walking the tree, using finder.on('error', CB) in my code, but am not knowledgable enough to know if this should be added to the code base or not.

Thanks,
Jeff


fs.lstat(base, function (err, s) {
if (err) {
em.emit('error', err);
}
if (s.isDirectory()) {
finder(base, em.emit.bind(em, 'end'));
}
else if (s.isSymbolicLink()) {
if (cb) cb(base, s);
em.emit('link', base, s);
em.emit('end');
}
else {
if (cb) cb(base, s);
em.emit('file', base, s);
em.emit('end');
}
});

@substack substack closed this
@substack substack closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.