Suppress verbose error in certificateStore

This commit is contained in:
Yuya Ochiai
2016-10-26 00:40:53 +09:00
parent 56e6fea525
commit 682c45aeab
2 changed files with 10 additions and 2 deletions

View File

@@ -26,11 +26,18 @@ function getHost(targetURL) {
var CertificateStore = function(storeFile) {
this.storeFile = storeFile;
let storeStr;
try {
this.data = JSON.parse(fs.readFileSync(storeFile, 'utf-8'));
storeStr = fs.readFileSync(storeFile, 'utf-8')
}
catch (e) {
console.log(e);
storeStr = '{}';
}
try {
this.data = JSON.parse(storeStr);
}
catch (e) {
console.log('Error when parsing', storeFile, ':', e);
this.data = {};
}
};