feat: custom exception handling

This commit is contained in:
Benexl
2025-07-13 12:29:06 +03:00
parent a2da6974fa
commit f02f92b80b
4 changed files with 79 additions and 10 deletions

View File

@@ -0,0 +1,16 @@
import sys
def custom_exception_hook(exc_type, exc_value, exc_traceback):
print(f"{exc_type.__name__}: {exc_value}")
default_exception_hook = sys.excepthook
# sys.tracebacklimit = 0
def setup_exceptions_handler(trace: bool | None, dev: bool | None):
if trace or dev:
sys.excepthook = default_exception_hook
else:
sys.excepthook = custom_exception_hook