feat: sendCoins error handling

This commit is contained in:
José Oliveira 2022-04-07 21:48:24 +01:00 committed by siiky
parent f37a73f983
commit 46f6879108

View file

@ -171,7 +171,14 @@ function sendCoins (account, tx, settings, operatorId) {
return sendFundsOnChain(wallet.id, toAddress, cryptoAtoms, account.authToken)
})
.then(result => {
return result
switch (result.status) {
case 'ALREADY_PAID':
throw new Error('Transaction already exists!')
case 'FAILURE':
throw new Error('Transaction failed!')
default:
return '<galoy transaction>'
}
})
.catch(err => {
throw err