dev@locazia: fix error handling toncenter

This commit is contained in:
user 2024-03-01 23:47:54 +03:00
parent 0c271e3482
commit 177dcdc76e
1 changed files with 4 additions and 4 deletions

View File

@ -26,13 +26,13 @@ class TonCenter:
self.last_used = time.time() self.last_used = time.time()
response = await client.request(method, f"{self.host}{endpoint}", *args, **kwargs) response = await client.request(method, f"{self.host}{endpoint}", *args, **kwargs)
if response.status_code != 200:
raise Exception(f'Error while TONCENTER request {endpoint}: {response.text}')
try: try:
if response.status_code != 200:
raise Exception(f'Error while toncenter request {endpoint}: {response.text}')
return response.json() return response.json()
except BaseException as e: except BaseException as e:
make_log("Toncenter", f'Error while request {endpoint}: {e}' + '\n' + response.text, level='error') make_log("Toncenter", f'Error while request {self.host}{endpoint}: {e}' + '\n' + response.text, level='error')
return await self.request(method, endpoint, *args, **kwargs) return await self.request(method, endpoint, *args, **kwargs)
async def send_boc(self, src: bytes): async def send_boc(self, src: bytes):