dev@locazia: fix error handling toncenter
This commit is contained in:
parent
0c271e3482
commit
177dcdc76e
|
|
@ -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):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue