added try/catch for no usage/string info, moved module load error back to default stringspace

This commit is contained in:
Luke Slater 2012-12-11 20:23:31 +00:00
parent fbf4242d66
commit 1f2c7fa835
3 changed files with 28 additions and 20 deletions

View File

@ -64,11 +64,5 @@
"spanish": "Cerrado la categoría: {category}",
"na'vi": "{category}ìri oel 'upxareti fmoli",
"welsh": "Categori wedi cloi: {category}"
},
"module_load_error": {
"english": "Failed to load module: {moduleName}",
"spanish": "No se pudó cargar el módulo: {moduleName}",
"na'vi": "Oeru Oel {moduleName}it sung.",
"welsh": "Wedi methu a llwytho modiwl: {moduleName}"
}
}

8
run.js
View File

@ -200,6 +200,7 @@ DBot.prototype.reloadModules = function() {
}
// Load the module usage data
try {
var usage = JSON.parse(fs.readFileSync(moduleDir + 'usage.json', 'utf-8'));
for(key in usage) {
if(usage.hasOwnProperty(key)) {
@ -210,8 +211,12 @@ DBot.prototype.reloadModules = function() {
}
}
}
} catch(err) {
// Invalid or no usage info
}
// Load the module string data
try {
var strings = JSON.parse(fs.readFileSync(moduleDir + 'strings.json', 'utf-8'));
for(key in strings) {
if(strings.hasOwnProperty(key)) {
@ -222,6 +227,9 @@ DBot.prototype.reloadModules = function() {
}
}
}
} catch(err) {
// Invalid or no string info
}
this.modules.push(module);
} catch(err) {

View File

@ -5,6 +5,12 @@
"na'vi": "Srake sweylu nga pamrel sivi: ",
"welsh": "A oeddech chi'n feddwl: "
},
"module_load_error": {
"english": "Failed to load module: {moduleName}",
"spanish": "No se pudó cargar el módulo: {moduleName}",
"na'vi": "Oeru Oel {moduleName}it sung.",
"welsh": "Wedi methu a llwytho modiwl: {moduleName}"
},
"url": {
"english": "http://{host}:{port}/{path}"
}