Permalink
Browse files

Throw error if you can't read directory path

  • Loading branch information...
1 parent 1b309f7 commit 6bfaafb7d104a8e2172b1476583d685b2933a7c7 mde committed Jul 23, 2012
Showing with 10 additions and 2 deletions.
  1. +1 −1 lib/test_task.js
  2. +9 −1 lib/utils/file.js
View
@@ -95,7 +95,7 @@ var TestTask = function (name, definition) {
// re-calling from inside to nest infinitely
jake.currentNamespace = jake.defaultNamespace;
- re = new RegExp(pat)
+ re = new RegExp(pat);
testFiles = self.testFiles.toArray().filter(function (f) {
return (re).test(f);
});
View
@@ -83,7 +83,14 @@ var fileUtils = new (function () {
var dir = path.normalize(dirPath)
, paths = []
, ret = [dir];
- paths = fs.readdirSync(dir);
+
+ try {
+ paths = fs.readdirSync(dir);
+ }
+ catch (e) {
+ throw new Error('Could not read path ' + dir);
+ }
+
paths.forEach(function (p) {
var curr = path.join(dir, p);
var stat = fs.statSync(curr);
@@ -94,6 +101,7 @@ var fileUtils = new (function () {
ret.push(curr);
}
});
+
return ret;
}

0 comments on commit 6bfaafb

Please sign in to comment.