lndrest: capture the pay error properly.

This commit is contained in:
fiatjaf 2021-04-06 10:22:37 -03:00
parent 946279674a
commit 59aaea47fd

View File

@ -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()