1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

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");
}); });