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

Make RcParser ignore errors at JSON.parse()

This commit is contained in:
asmsuechan
2017-08-11 08:18:47 +09:00
parent f14ce0d68e
commit 95aec54f60

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 {