From 5add544ad7ea47568bb010d6aa7314c24fca3de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Wed, 21 Jul 2021 02:22:04 +0100 Subject: [PATCH] feat: send InsufficientFundsError correct error code for machine logic --- lib/routes/txRoutes.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/routes/txRoutes.js b/lib/routes/txRoutes.js index 8e2e6c5a..218d223f 100644 --- a/lib/routes/txRoutes.js +++ b/lib/routes/txRoutes.js @@ -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)