better error handling for custom langauge files

v1.18.x
psychobunny 11 years ago
parent 8146358aac
commit cf031be904

@ -262,8 +262,15 @@ var fs = require('fs'),
async.each(languages, function(pathToLang, next) {
fs.readFile(pathToLang, function(err, file) {
try {
var json = JSON.parse(file.toString());
} catch (err) {
winston.error('[plugins] Unable to parse custom language file: ' + pathToLang + '\r\n' + err.stack);
return next(err);
}
arr.push({
file: JSON.parse(file.toString()),
file: json,
route: pathToLang.replace(pathToFolder, '')
});

Loading…
Cancel
Save