handle cash-in errors

This commit is contained in:
Josh Harvey 2017-04-23 13:44:36 +03:00
parent 48dd23c11d
commit 86adfd0a63
7 changed files with 40 additions and 24 deletions

View file

@ -1,6 +1,8 @@
const BitGo = require('bitgo')
const BN = require('../../../bn')
const E = require('../../../error')
const pjson = require('../../../../package.json')
const userAgent = 'Lamassu-Server/' + pjson.version
@ -38,9 +40,7 @@ function sendCoins (account, address, cryptoAtoms, cryptoCode) {
return result.hash
})
.catch(err => {
if (err.message === 'Insufficient funds') {
err.name = 'InsufficientFunds'
}
if (err.message === 'Insufficient funds') throw new E.InsufficientFundsError()
throw err
})
}