@@ -93,9 +93,19 @@ async def get_payment_request(url: str) -> 'PaymentRequest':
|
|||||||
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 as e:
|
||||||
error = f"Error while contacting payment URL:\n{repr(e)}"
|
error = f"Error while contacting payment URL: {url}.\nerror type: {type(e)}"
|
||||||
if isinstance(e, aiohttp.ClientResponseError) and e.status == 400 and resp_content:
|
if isinstance(e, aiohttp.ClientResponseError):
|
||||||
error += "\n" + resp_content.decode("utf8")
|
error += f"\nGot HTTP status code {e.status}."
|
||||||
|
if resp_content:
|
||||||
|
try:
|
||||||
|
error_text_received = resp_content.decode("utf8")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
error_text_received = "(failed to decode error)"
|
||||||
|
else:
|
||||||
|
error_text_received = error_text_received[:400]
|
||||||
|
error_oneline = ' -- '.join(error.split('\n'))
|
||||||
|
_logger.info(f"{error_oneline} -- [DO NOT TRUST THIS MESSAGE] "
|
||||||
|
f"{repr(e)} text: {error_text_received}")
|
||||||
data = None
|
data = None
|
||||||
elif u.scheme == 'file':
|
elif u.scheme == 'file':
|
||||||
try:
|
try:
|
||||||
@@ -305,9 +315,19 @@ class PaymentRequest:
|
|||||||
print(f"PaymentACK message received: {paymntack.memo}")
|
print(f"PaymentACK message received: {paymntack.memo}")
|
||||||
return True, paymntack.memo
|
return True, paymntack.memo
|
||||||
except aiohttp.ClientError as e:
|
except aiohttp.ClientError as e:
|
||||||
error = f"Payment Message/PaymentACK Failed:\n{repr(e)}"
|
error = f"Payment Message/PaymentACK Failed:\nerror type: {type(e)}"
|
||||||
if isinstance(e, aiohttp.ClientResponseError) and e.status == 400 and resp_content:
|
if isinstance(e, aiohttp.ClientResponseError):
|
||||||
error += "\n" + resp_content.decode("utf8")
|
error += f"\nGot HTTP status code {e.status}."
|
||||||
|
if resp_content:
|
||||||
|
try:
|
||||||
|
error_text_received = resp_content.decode("utf8")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
error_text_received = "(failed to decode error)"
|
||||||
|
else:
|
||||||
|
error_text_received = error_text_received[:400]
|
||||||
|
error_oneline = ' -- '.join(error.split('\n'))
|
||||||
|
_logger.info(f"{error_oneline} -- [DO NOT TRUST THIS MESSAGE] "
|
||||||
|
f"{repr(e)} text: {error_text_received}")
|
||||||
return False, error
|
return False, error
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -800,6 +800,7 @@ def parse_URI(uri: str, on_pr: Callable = None, *, loop=None) -> dict:
|
|||||||
sig = out.get('sig')
|
sig = out.get('sig')
|
||||||
name = out.get('name')
|
name = out.get('name')
|
||||||
if on_pr and (r or (name and sig)):
|
if on_pr and (r or (name and sig)):
|
||||||
|
@log_exceptions
|
||||||
async def get_payment_request():
|
async def get_payment_request():
|
||||||
from . import paymentrequest as pr
|
from . import paymentrequest as pr
|
||||||
if name and sig:
|
if name and sig:
|
||||||
|
|||||||
Reference in New Issue
Block a user