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

@ -9,16 +9,22 @@ const E = require('../../../error')
const cryptoRec = coinUtils.getCryptoCurrency('DASH')
const configPath = coinUtils.configPath(cryptoRec)
const unitScale = cryptoRec.unitScale
const config = jsonRpc.parseConf(configPath)
const rpcConfig = {
username: config.rpcuser,
password: config.rpcpassword,
port: config.rpcport || cryptoRec.defaultPort
function rpcConfig () {
try {
const config = jsonRpc.parseConf(configPath)
return {
username: config.rpcuser,
password: config.rpcpassword,
port: config.rpcport || cryptoRec.defaultPort
}
} catch (err) {
throw new Error('wallet is currently not installed')
}
}
function fetch (method, params) {
return jsonRpc.fetch(rpcConfig, method, params)
return jsonRpc.fetch(rpcConfig(), method, params)
}
function checkCryptoCode (cryptoCode) {