LndResWallet: catch http errors (#2133)
This commit is contained in:
parent
abbcfbeb6a
commit
165d7499ea
1 changed files with 14 additions and 6 deletions
|
|
@ -139,14 +139,22 @@ class LndRestWallet(Wallet):
|
|||
lnrpcFeeLimit = dict()
|
||||
lnrpcFeeLimit["fixed_msat"] = f"{fee_limit_msat}"
|
||||
|
||||
try:
|
||||
r = await self.client.post(
|
||||
url="/v1/channels/transactions",
|
||||
json={"payment_request": bolt11, "fee_limit": lnrpcFeeLimit},
|
||||
timeout=None,
|
||||
)
|
||||
r.raise_for_status()
|
||||
except Exception as exc:
|
||||
logger.warning(f"LndRestWallet pay_invoice POST error: {exc}.")
|
||||
return PaymentResponse(None, None, None, None, str(exc))
|
||||
|
||||
if r.is_error or r.json().get("payment_error"):
|
||||
data = r.json()
|
||||
|
||||
if data.get("payment_error"):
|
||||
error_message = r.json().get("payment_error") or r.text
|
||||
logger.warning(f"LndRestWallet pay_invoice payment_error: {error_message}.")
|
||||
return PaymentResponse(False, None, None, None, error_message)
|
||||
|
||||
data = r.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue