Catch exception if we try to log due to config.hjson error

This commit is contained in:
Bryan Ashby 2018-07-04 17:58:38 -06:00
parent 0f6924a916
commit 8922bb6683
1 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,11 @@ module.exports = new class ConfigCache
parsed = hjson.parse(data); parsed = hjson.parse(data);
this.cache.set(path, parsed); this.cache.set(path, parsed);
} catch(e) { } catch(e) {
try {
require('./logger.js').log.error( { filePath : path, error : e.message }, 'Failed to re-cache' ); require('./logger.js').log.error( { filePath : path, error : e.message }, 'Failed to re-cache' );
} catch(ignored) {
// nothing - we may be failing to parse the config in which we can't log here!
}
return cb(e); return cb(e);
} }