From eea01f10ace4d8393875ede77a868c84ea1a1661 Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Thu, 17 Jan 2019 17:00:07 -0800 Subject: [PATCH] Added catch for exceptions, removed uneeded duplicate test. --- browser/main/lib/dataApi/init.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/browser/main/lib/dataApi/init.js b/browser/main/lib/dataApi/init.js index 5149c263..0dbcc182 100644 --- a/browser/main/lib/dataApi/init.js +++ b/browser/main/lib/dataApi/init.js @@ -55,8 +55,12 @@ function init () { }) } }) - if (unknownCount > 0 && fs.existsSync(storage.path)) { - CSON.writeFileSync(path.join(storage.path, 'boostnote.json'), _.pick(storage, ['folders', 'version'])) + if (unknownCount > 0) { + try { + CSON.writeFileSync(path.join(storage.path, 'boostnote.json'), _.pick(storage, ['folders', 'version'])) + } catch (e) { + console.log('Error writting boostnote.json: ' + e + ' from init.js') + } } return notes })