feat: send InsufficientFundsError correct error code for machine logic

This commit is contained in:
Sérgio Salgado 2021-07-21 02:22:04 +01:00 committed by Josh Harvey
parent 4876c5d1b6
commit 5add544ad7

View file

@ -17,7 +17,12 @@ function postTx (req, res, next) {
.then(tx => {
if (tx.errorCode) {
logger.error(tx.error)
throw httpError(tx.error, 500)
switch (tx.errorCode) {
case 'InsufficientFundsError':
throw httpError(tx.error, 570)
default:
throw httpError(tx.error, 500)
}
}
return res.json(tx)