diff --git a/unipay/providers/wechat.py b/unipay/providers/wechat.py index d231817..90ccb8c 100644 --- a/unipay/providers/wechat.py +++ b/unipay/providers/wechat.py @@ -167,13 +167,16 @@ class WechatGateway(Gateway): auth = self._sign("POST", url_path, body_str) async with aiohttp.ClientSession() as session: - async with session.post(url, data=body_str, headers={ - "Authorization": f"WECHATPAY2-SHA256-RSA2048 {auth}", - "Content-Type": "application/json" - }) as resp: - ret = await resp.json() - return ret.get("h5_url") - + try: + async with session.post(url, data=body_str, headers={ + "Authorization": f"WECHATPAY2-SHA256-RSA2048 {auth}", + "Content-Type": "application/json" + }) as resp: + ret = await resp.json() + return ret.get("h5_url") + except EXception as e: + exception(f'{e}, {url=}, {body_str=}, {auth=}') + raise e return None # -----------------------------------------------------