fix: custom error handling for all wallets and cache update

This commit is contained in:
José Oliveira 2021-02-26 16:30:20 +00:00 committed by Josh Harvey
parent 145a21cc8d
commit 34704e071d
8 changed files with 61 additions and 41 deletions

View file

@ -48,21 +48,18 @@ function split (str) {
}
function parseConf (confPath) {
try {
const conf = fs.readFileSync(confPath)
const lines = conf.toString().split('\n')
const conf = fs.readFileSync(confPath)
const lines = conf.toString().split('\n')
const res = {}
for (let i = 0; i < lines.length; i++) {
const keyVal = split(lines[i])
const res = {}
for (let i = 0; i < lines.length; i++) {
const keyVal = split(lines[i])
// skip when value is empty
if (!keyVal[1]) continue
// skip when value is empty
if (!keyVal[1]) continue
res[keyVal[0]] = keyVal[1]
}
return res
} catch (e) {
throw new Error('wallet is currently not installed')
res[keyVal[0]] = keyVal[1]
}
return res
}