Exit on error.

pull/851/head
Marcel Klehr 2012-07-10 21:38:14 +02:00
parent 4c8f69b7c5
commit 8858446678
1 changed files with 5 additions and 5 deletions

View File

@ -111,7 +111,8 @@ try{
//read the settings sync //read the settings sync
settingsStr = fs.readFileSync(settingsFilename); settingsStr = fs.readFileSync(settingsFilename);
} catch(e){ } catch(e){
console.warn('No settings file found. Using defaults.'); console.error('No settings file found.');
process.exit(1);
} }
// try to parse the settings // try to parse the settings
@ -121,8 +122,8 @@ try {
settings = vm.runInContext('exports = '+settingsStr, vm.createContext(), "settings.json"); settings = vm.runInContext('exports = '+settingsStr, vm.createContext(), "settings.json");
} }
}catch(e){ }catch(e){
console.warn('There was an error processing your settings.json file. Using defaults.'); console.error('There was an error processing your settings.json file: '+e.message);
console.warn(e.message); process.exit(1);
} }
//loop trough the settings //loop trough the settings
@ -142,8 +143,7 @@ for(var i in settings)
//this setting is unkown, output a warning and throw it away //this setting is unkown, output a warning and throw it away
else else
{ {
console.warn("Unkown Setting: '" + i + "'"); console.warn("Unkown Setting: '" + i + "'. This setting doesn't exist or it was removed");
console.warn("This setting doesn't exist or it was removed");
} }
} }