From 64440f7c1c81c49af451707429f2368fb6164b91 Mon Sep 17 00:00:00 2001 From: mmcw-dev Date: Wed, 20 Dec 2017 21:39:17 -0500 Subject: [PATCH] Set state if invalid. Hopefully it overwrites? --- lib/intval/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/intval/index.js b/lib/intval/index.js index 5687266..fd43121 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -66,9 +66,7 @@ intval.init = function () { forgiveParseErrors: false // [NEW] }).then(intval._restoreState).catch((err) => { log.error('init', err) - console.dir(fs.rmdirSync('./state')) - log.warn('Restarting') - return process.exit(1) + return intval._setState() }) process.on('SIGINT', intval._undeclarePins) @@ -79,7 +77,7 @@ intval._restoreState = function (res) { //console.dir(res) storage.getItem('_state', 'test').then(intval._setState).catch((err) => { intval._setState(undefined) - log.error('init', err) + log.error('_restoreState', err) }) intval._declarePins() } @@ -91,6 +89,7 @@ intval._setState = function (data) { log.info('_setState', 'Restored intval state from disk') return true } + log.info('_setState', 'Setting state from defaults') intval._state = { frame : { dir : true, //forward