From 840d6a6e3046f9ae40875114f30519e914ca37a1 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 15 Jun 2014 19:04:54 +0100 Subject: [PATCH] Log errors on loading locales --- server/httphandler.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)); } -- 2.25.1