fix: log only a msg in case of insufficient funds

This commit is contained in:
Nikola Ubavic 2021-10-27 18:38:33 +02:00
parent ff474ee507
commit f740942f42

View file

@ -10,7 +10,7 @@ const ticker = require('../lib/ticker')
const [toAddress, cryptoValue, cryptoCode] = process.argv.slice(2) const [toAddress, cryptoValue, cryptoCode] = process.argv.slice(2)
function computeCrypto (cryptoCode, value) { function computeCrypto(cryptoCode, value) {
try { try {
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode) const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
@ -80,7 +80,12 @@ settingsLoader.loadLatest()
console.log('Success.') console.log('Success.')
process.exit(0) process.exit(0)
}) })
.catch(console.log) .catch(e => {
if (e.name === 'InsufficientFundsError')
console.log(e.message)
else
console.log(e)
})
}) })
.catch(console.log) .catch(console.log)
}) })