minor cleanup, throw on previously unchecked error

This commit is contained in:
AJ ONeal 2018-11-04 14:28:07 -07:00
parent d5a622444e
commit 75f538fa16
2 changed files with 11 additions and 8 deletions

View File

@ -306,8 +306,8 @@ var RC;
function parseConfig(err, text) { function parseConfig(err, text) {
function handleConfig(err, config) { function handleConfig(err, config) {
//console.log('CONFIG'); if (err) { throw err; }
//console.log(config);
state.config = config; state.config = config;
var verstrd = [ pkg.name + ' daemon v' + state.config.version ]; var verstrd = [ pkg.name + ' daemon v' + state.config.version ];
if (state.config.version && state.config.version !== pkg.version) { if (state.config.version && state.config.version !== pkg.version) {
@ -652,7 +652,7 @@ function parseConfig(err, text) {
}); });
} }
RC.request({ service: 'config', method: 'GET' }, handleRemoteRequest('config', handleConfig)); RC.request({ service: 'config', method: 'GET' }, handleConfig);
} }
var parsers = { var parsers = {

View File

@ -44,11 +44,14 @@ module.exports.create = function (state) {
err.code = "E_REQUEST"; err.code = "E_REQUEST";
} }
if (body) {
try { try {
body = JSON.parse(body); body = JSON.parse(body);
} catch(e) { } catch(e) {
console.error('Error:', err);
// ignore // ignore
} }
}
fn(err, body); fn(err, body);
} }