From: Darren Date: Sun, 15 Jun 2014 18:04:54 +0000 (+0100) Subject: Log errors on loading locales X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=840d6a6e3046f9ae40875114f30519e914ca37a1;p=KiwiIRC.git Log errors on loading locales --- diff --git a/server/httphandler.js b/server/httphandler.js index 1ee9d00..3049972 100644 --- a/server/httphandler.js +++ b/server/httphandler.js @@ -4,6 +4,7 @@ var url = require('url'), Negotiator = require('negotiator'), _ = require('lodash'), config = require('./configuration.js'), + winston = require('winston'), SettingsGenerator = require('./settingsgenerator.js'); @@ -64,7 +65,15 @@ var cached_available_locales = []; // Get a list of the available translations we have fs.readdir('client/assets/locales', function (err, files) { - files.forEach(function (file) { + if (err) { + if (err.code === 'ENOENT') { + winston.error('No locale files could be found at ' + err.path); + } else { + winston.error('Error reading locales.', err); + } + } + + (files || []).forEach(function (file) { if (file.substr(-5) === '.json') { cached_available_locales.push(file.slice(0, -5)); }