Handle parse errors in template file

This commit is contained in:
Nick O'Leary 2014-05-07 20:45:26 +01:00
parent 7b0a1b2463
commit 3c176d0b94
1 changed files with 5 additions and 2 deletions

View File

@ -34,9 +34,12 @@ var node_scripts = [];
function loadTemplate(templateFilename) { function loadTemplate(templateFilename) {
return when.promise(function(resolve,reject) { return when.promise(function(resolve,reject) {
whenNode.call(fs.readFile,templateFilename,'utf8').done(function(content) { whenNode.call(fs.readFile,templateFilename,'utf8').done(function(content) {
registerConfig(content); try {
registerConfig(content);
} catch(err) {
reject("invalid template file: "+err.message);
}
resolve(); resolve();
//console.log(templateFilename);
}, function(err) { }, function(err) {
reject("missing template file"); reject("missing template file");
}); });