From 1ad26e21b85f347ef72ccd4865e95657e01a0f40 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Wed, 6 Mar 2019 23:59:06 +0000 Subject: [PATCH] ADD: Proper error message when payment fails --- controllers/api.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/controllers/api.js b/controllers/api.js index 7e51b10..922be87 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -198,7 +198,7 @@ router.post('/payinvoice', async function(req, res) { } else { // payment failed lock.releaseLock(); - return errorLnd(res); + return errorPaymentFailed(res); } }); if (!info.num_satoshis && !info.num_satoshis) { @@ -216,7 +216,7 @@ router.post('/payinvoice', async function(req, res) { call.write(inv); } catch (Err) { await lock.releaseLock(); - return errorLnd(res); + return errorPaymentFailed(res); } } else { await lock.releaseLock(); @@ -412,3 +412,11 @@ function errorTryAgainLater(res) { message: 'Your previous payment is in transit. Try again in 5 minutes', }); } + +function errorPaymentFailed(res) { + return res.send({ + error: true, + code: 10, + message: 'Payment failed. Does the receiver have enough inbound capacity?', + }); +}