bip70 payreq: catch TimeoutError to avoid hanging "please wait" dialog

related #5337
This commit is contained in:
SomberNight 2019-08-27 18:03:01 +02:00
parent 3076eb75ea
commit db8e6cabb4
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -25,12 +25,11 @@
import hashlib
import sys
import time
import traceback
import json
from typing import Optional
import asyncio
import urllib.parse
import certifi
import urllib.parse
import aiohttp
@ -87,7 +86,7 @@ async def get_payment_request(url: str) -> 'PaymentRequest':
data = resp_content
data_len = len(data) if data is not None else None
_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)}"
if isinstance(e, aiohttp.ClientResponseError):
error += f"\nGot HTTP status code {e.status}."