1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Merge pull request #789 from asmsuechan/try-catch-in-rc-parser

Make RcParser ignore errors at JSON.parse()
This commit is contained in:
SuenagaRyota
2017-08-11 08:38:00 +09:00
committed by GitHub

View File

@@ -7,7 +7,13 @@ function parse () {
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
if (!sander.existsSync(boostnotercPath)) return {}
return JSON.parse(sander.readFileSync(boostnotercPath).toString())
try {
return JSON.parse(sander.readFileSync(boostnotercPath).toString())
} catch (e) {
console.warn(e)
console.warn('Your .boostnoterc is broken so it\'s not used.')
return {}
}
}
export default {