From 59aaea47fdefa4dac8dc2695f44334fe09841a56 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 6 Apr 2021 10:22:37 -0300 Subject: [PATCH] lndrest: capture the pay error properly. --- lnbits/wallets/lndrest.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lnbits/wallets/lndrest.py b/lnbits/wallets/lndrest.py index fa46c573e..b6746c6b8 100644 --- a/lnbits/wallets/lndrest.py +++ b/lnbits/wallets/lndrest.py @@ -102,12 +102,8 @@ class LndRestWallet(Wallet): timeout=180, ) - if r.is_error: - error_message = r.text - try: - error_message = r.json()["error"] - except: - pass + if r.is_error or r.json().get("payment_error"): + error_message = r.json().get("payment_error") or r.text return PaymentResponse(False, None, 0, None, error_message) data = r.json()