From 69063190ab89f2fa790745456bd342b5d907f638 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 12 Oct 2020 22:25:55 -0300 Subject: [PATCH] also catch httpx.ConnectError whenever we do catch httpx.RequestError. --- lnbits/core/views/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 7ff1e88e0..25c1ff4f4 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -85,7 +85,7 @@ async def api_payments_create_invoice(): lnurl_response = resp["reason"] else: lnurl_response = True - except httpx.RequestError: + except (httpx.ConnectError, httpx.RequestError): lnurl_response = False return ( @@ -151,7 +151,7 @@ async def api_payments_pay_lnurl(): r = httpx.get(g.data["callback"], params={"amount": g.data["amount"]}, timeout=20) if r.is_error: return jsonify({"message": "failed to connect"}), HTTPStatus.BAD_REQUEST - except httpx.RequestError: + except (httpx.ConnectError, httpx.RequestError): return jsonify({"message": "failed to connect"}), HTTPStatus.BAD_REQUEST params = json.loads(r.text)