Fixed error reporting for lntxbot source

This commit is contained in:
benarc 2021-11-12 10:16:15 +00:00
parent 267dea4f75
commit 78f7a3914f
2 changed files with 5 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class LNbitsWallet(Wallet):
async with httpx.AsyncClient() as client:
r = await client.post(
url=f"{self.endpoint}/api/v1/payments", headers=self.key, json=data
url=f"{self.endpoint}/api/v1/payments", headers=self.key, json=data,
)
ok, checking_id, payment_request, error_message = (
not r.is_error,
@ -86,6 +86,7 @@ class LNbitsWallet(Wallet):
url=f"{self.endpoint}/api/v1/payments",
headers=self.key,
json={"out": True, "bolt11": bolt11},
timeout=100,
)
ok, checking_id, fee_msat, error_message = not r.is_error, None, 0, None

View File

@ -80,10 +80,10 @@ class LntxbotWallet(Wallet):
f"{self.endpoint}/payinvoice",
headers=self.auth,
json={"invoice": bolt11},
timeout=40,
timeout=100,
)
if r.is_error:
if "error" in r.json():
try:
data = r.json()
error_message = data["message"]