add try-catch to bin watching compilation - fixes #901

This commit is contained in:
Sebastian McKenzie 2015-02-26 21:28:54 +11:00
parent 75b5f32e7a
commit 1eb53dd13a
2 changed files with 10 additions and 2 deletions

View File

@ -64,7 +64,11 @@ module.exports = function (commander, filenames, opts) {
_.each(["add", "change"], function (type) {
watcher.on(type, function (filename) {
var relative = path.relative(dirname, filename) || filename;
if (util.canCompile(filename)) write(filename, relative);
try {
if (util.canCompile(filename)) write(filename, relative);
} catch (err) {
console.error(err.stack);
}
});
});
});

View File

@ -119,7 +119,11 @@ module.exports = function (commander, filenames) {
}).on("all", function (type, filename) {
if (type === "add" || type === "change") {
console.log(type, filename);
walk();
try {
walk();
} catch (err) {
console.error(err.stack);
}
}
});
}