Show exception class name

This commit is contained in:
blank X 2020-11-18 20:09:09 +07:00
parent bdd3c23a63
commit 81b3d012b8
1 changed files with 3 additions and 3 deletions

View File

@ -92,7 +92,7 @@ async def get_spamwatch(entity):
try:
json = await resp.json()
except Exception as ex:
return f'- <b>{resp.status}:</b> {html.escape(str(ex))}'
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
if 'code' in json:
return f'- <b>{json["code"]}:</b> {html.escape(json.get("error", ""))}'
return f'''- <b>Banned on:</b> {str(datetime.datetime.fromtimestamp(json["date"]))}
@ -153,7 +153,7 @@ async def get_cas(entity):
try:
json = await resp.json()
except Exception as ex:
return f'- <b>{resp.status}:</b> {html.escape(str(ex))}'
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
if json['ok']:
return f'''- <b>Banned on:</b> {str(datetime.datetime.fromisoformat(json["result"]["time_added"][:-1]))}
- <b>Offenses:</b> {json["result"]["offenses"]}'''
@ -164,7 +164,7 @@ async def get_spam_protection(entity):
try:
json = await resp.json()
except Exception as ex:
return f'- <b>{resp.status}:</b> {html.escape(str(ex))}'
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
if json['success']:
text = ''
if json['results']['attributes']['intellivoid_accounts_verified']: