2025-06-22 20:49:07 +02:00
|
|
|
import sys
|
|
|
|
import traceback
|
|
|
|
import os
|
2025-07-23 15:42:13 +03:00
|
|
|
from modules.settings import instance as settings_manager
|
2025-07-22 19:32:19 +03:00
|
|
|
import logging
|
|
|
|
from modules.globalvars import RED, RESET
|
|
|
|
import modules.keys as k
|
|
|
|
|
|
|
|
settings = settings_manager.settings
|
|
|
|
logger = logging.getLogger("goober")
|
2025-06-22 20:49:07 +02:00
|
|
|
|
2025-07-23 10:19:08 +03:00
|
|
|
|
2025-06-22 20:49:07 +02:00
|
|
|
def handle_exception(exc_type, exc_value, exc_traceback, *, context=None):
|
2025-07-23 10:19:08 +03:00
|
|
|
os.system("cls" if os.name == "nt" else "clear")
|
|
|
|
|
2025-06-22 20:49:07 +02:00
|
|
|
if issubclass(exc_type, KeyboardInterrupt):
|
|
|
|
sys.__excepthook__(exc_type, exc_value, exc_traceback)
|
|
|
|
return
|
|
|
|
|
2025-07-23 10:19:08 +03:00
|
|
|
with open(settings["splash_text_loc"], "r") as f:
|
2025-07-22 19:32:19 +03:00
|
|
|
print("".join(f.readlines()))
|
|
|
|
|
2025-06-22 20:49:07 +02:00
|
|
|
print(f"{RED}=====BEGINNING OF TRACEBACK====={RESET}")
|
|
|
|
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
|
|
|
print(f"{RED}========END OF TRACEBACK========{RESET}")
|
2025-07-22 19:32:19 +03:00
|
|
|
print(f"{RED}{k.unhandled_exception()}{RESET}")
|
2025-07-05 20:15:54 +02:00
|
|
|
|
2025-06-22 20:49:07 +02:00
|
|
|
if context:
|
|
|
|
print(f"{RED}Context: {context}{RESET}")
|