mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 18:56: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:
@@ -7,7 +7,13 @@ function parse () {
|
|||||||
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
|
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
|
||||||
|
|
||||||
if (!sander.existsSync(boostnotercPath)) return {}
|
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 {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user