mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-12 09:51:06 +02:00
except timeout
This commit is contained in:
parent
f8f042a67b
commit
4ad463d3a8
@ -7,7 +7,7 @@ from collections.abc import AsyncGenerator
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from httpx import HTTPError
|
from httpx import HTTPError, TimeoutException
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from websockets.client import connect
|
from websockets.client import connect
|
||||||
|
|
||||||
@ -175,8 +175,13 @@ class PhoenixdWallet(Wallet):
|
|||||||
timeout=40,
|
timeout=40,
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
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:
|
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}."
|
msg = f"Unable to connect to {self.endpoint}."
|
||||||
logger.error(msg)
|
logger.error(msg)
|
||||||
logger.error(exc)
|
logger.error(exc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user