mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
bip70 payreq: catch TimeoutError to avoid hanging "please wait" dialog
related #5337
This commit is contained in:
parent
3076eb75ea
commit
db8e6cabb4
1 changed files with 3 additions and 4 deletions
|
@ -25,12 +25,11 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
import json
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import asyncio
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
import certifi
|
import certifi
|
||||||
import urllib.parse
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ async def get_payment_request(url: str) -> 'PaymentRequest':
|
||||||
data = resp_content
|
data = resp_content
|
||||||
data_len = len(data) if data is not None else None
|
data_len = len(data) if data is not None else None
|
||||||
_logger.info(f'fetched payment request {url} {data_len}')
|
_logger.info(f'fetched payment request {url} {data_len}')
|
||||||
except aiohttp.ClientError as e:
|
except (aiohttp.ClientError, asyncio.TimeoutError) as e:
|
||||||
error = f"Error while contacting payment URL: {url}.\nerror type: {type(e)}"
|
error = f"Error while contacting payment URL: {url}.\nerror type: {type(e)}"
|
||||||
if isinstance(e, aiohttp.ClientResponseError):
|
if isinstance(e, aiohttp.ClientResponseError):
|
||||||
error += f"\nGot HTTP status code {e.status}."
|
error += f"\nGot HTTP status code {e.status}."
|
||||||
|
|
Loading…
Add table
Reference in a new issue