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