mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-07 20:34:52 +00:00
fix
This commit is contained in:
parent
1bb6943ffb
commit
67746303f3
1 changed files with 33 additions and 6 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import pickle
|
import pickle
|
||||||
import traceback
|
import traceback
|
||||||
|
|
@ -156,12 +157,38 @@ async def evaluation_cmd_t(_, m):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await aexec(cmd, _, m)
|
await aexec(cmd, _, m)
|
||||||
except Exception:
|
except NameError as e:
|
||||||
# exc = traceback.format_exc(limit=4)
|
trace_output = "<b>❌ MISSING VARIABEL:</b>\n"
|
||||||
exc_type, exc_value, exc_tb = sys.exc_info()
|
trace_output += f"<code>{e}</code>"
|
||||||
tb = traceback.TracebackException(exc_type, exc_value, exc_tb)
|
exc = trace_output
|
||||||
exc = f"{exc_type} {exc_value} {exc_tb}\n\n{tb}"
|
except AttributeError as e:
|
||||||
# print(''.join(tb.format_exception_only()))
|
trace_output = "<b>❌ MISSING ATTRIBUTE:</b>\n"
|
||||||
|
trace_output += f"<code>{e}</code>"
|
||||||
|
exc = trace_output
|
||||||
|
except SyntaxError as e:
|
||||||
|
trace = traceback.format_exc()
|
||||||
|
splitted = str(trace).split("\n")
|
||||||
|
end_split = len(splitted)
|
||||||
|
row_1 = splitted[end_split - 4]
|
||||||
|
row_2 = splitted[end_split - 3]
|
||||||
|
row_3 = splitted[end_split - 2]
|
||||||
|
compiles = row_1 + "\n" + row_2 + "\n" + row_3
|
||||||
|
trace_output = "<b>⚙️ SYNTAX ERROR:</b>\n"
|
||||||
|
trace_output += f"<code>{compiles}</code>"
|
||||||
|
exc = trace_output
|
||||||
|
except ValueError as e:
|
||||||
|
trace_output = "<b>🧮 VALUE ERROR:</b>\n"
|
||||||
|
trace_output += f"<code>{e}</code>"
|
||||||
|
exc = trace_output
|
||||||
|
except Exception as e:
|
||||||
|
#trace = traceback.format_exc()
|
||||||
|
""" Periksa apakah error regexnya tertangkap"""
|
||||||
|
match = re.search(r"Telegram says: .+", str(e))
|
||||||
|
trace_output = "<b>⚠️ COMMON ERROR:</b>\n"
|
||||||
|
trace_output += f"<code>{e}</code>"
|
||||||
|
if match:
|
||||||
|
trace_output = f"<code>👀 {match[0]}</code>"
|
||||||
|
exc = trace_output
|
||||||
|
|
||||||
stdout = redirected_output.getvalue()
|
stdout = redirected_output.getvalue()
|
||||||
stderr = redirected_error.getvalue()
|
stderr = redirected_error.getvalue()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue