ADD: Proper error message when payment fails

This commit is contained in:
Overtorment 2019-03-06 23:59:06 +00:00
parent f7ed99173f
commit 1ad26e21b8

View File

@ -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?',
});
}