Merge pull request #791 from diegodorado/rc-file-check

Wraps .jsbeautifyrc file read into a try/catch since it could be no l…
This commit is contained in:
Glavin Wiechert 2016-02-20 15:31:30 -04:00
commit 19be23015a
1 changed files with 6 additions and 3 deletions

View File

@ -637,9 +637,12 @@ module.exports = class Beautifiers extends EventEmitter
externalOptions = undefined
if configPath
fs ?= require("fs")
contents = fs.readFileSync(configPath,
encoding : "utf8"
)
try
contents = fs.readFileSync(configPath,
encoding : "utf8"
)
catch error
contents = null #file isnt available anymore
unless contents
externalOptions = {}
else