head hurts, kill me
This commit is contained in:
parent
a96616e4a2
commit
9096363ea6
5 changed files with 227 additions and 1 deletions
23
modules/unhandledexception.py
Normal file
23
modules/unhandledexception.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import sys
|
||||
import traceback
|
||||
import os
|
||||
from modules.globalvars import RED, RESET, splashtext
|
||||
|
||||
def handle_exception(exc_type, exc_value, exc_traceback, *, context=None):
|
||||
os.system('cls' if os.name == 'nt' else 'clear')
|
||||
|
||||
if issubclass(exc_type, KeyboardInterrupt):
|
||||
sys.__excepthook__(exc_type, exc_value, exc_traceback)
|
||||
return
|
||||
|
||||
print(splashtext)
|
||||
print(f"{RED}=====BEGINNING OF TRACEBACK====={RESET}")
|
||||
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
||||
print(f"{RED}========END OF TRACEBACK========{RESET}")
|
||||
print(f"{RED}An unhandled exception occurred. Please report this issue on GitHub.{RESET}")
|
||||
|
||||
if context:
|
||||
print(f"{RED}Context: {context}{RESET}")
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue