From 4ad463d3a8fbc86c0386e590eb23b9d2518c40f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 31 Mar 2025 17:35:54 +0200 Subject: [PATCH] except timeout --- lnbits/wallets/phoenixd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lnbits/wallets/phoenixd.py b/lnbits/wallets/phoenixd.py index b4e2af751..c7cada994 100644 --- a/lnbits/wallets/phoenixd.py +++ b/lnbits/wallets/phoenixd.py @@ -7,7 +7,7 @@ from collections.abc import AsyncGenerator from typing import Any, Optional import httpx -from httpx import HTTPError +from httpx import HTTPError, TimeoutException from loguru import logger from websockets.client import connect @@ -175,8 +175,13 @@ class PhoenixdWallet(Wallet): timeout=40, ) r.raise_for_status() + except TimeoutException: + # be safe and return pending on timeouts + msg = f"Timeout connecting to {self.endpoint}." + logger.error(msg) + return PaymentResponse(ok=None, error_message=msg) except HTTPError as exc: - # HTTPError includes all 4xx and 5xx responses and timeout, + # HTTPError includes all 4xx and 5xx responses msg = f"Unable to connect to {self.endpoint}." logger.error(msg) logger.error(exc)