Set state if invalid. Hopefully it overwrites?

This commit is contained in:
mmcw-dev 2017-12-20 21:39:17 -05:00
parent ec156fc8b6
commit 64440f7c1c
1 changed files with 3 additions and 4 deletions

View File

@ -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