Permalink
Browse files

In example app, properly handle case where a project doesn't have a r…

…eadme.
  • Loading branch information...
1 parent 704e61f commit a069100af873a18b2b23003fc4e8eaa07155e26c @miccolis miccolis committed Jul 27, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 examples/simple/models/Project.server.bones
@@ -33,9 +33,11 @@ models.Project.prototype.sync = function(method, model, options) {
fs.readdir(projectDir, function(err, files) {
if (err) return callback('Project not found.');
+ var found = false;
for (var i = 0; i < files.length; i++) {
var match = re.exec(files[i]);
if (match) {
+ found = true;
fs.readFile(projectDir +'/'+ match.input, 'utf8', function(err, data) {
if (err) return callback('Could not retrieve project information.');
// 80 chars folks...
@@ -46,6 +48,7 @@ models.Project.prototype.sync = function(method, model, options) {
break;
}
}
+ if (!found) return callback('Project is missing a readme file.');
});
}

0 comments on commit a069100

Please sign in to comment.