from abc import abstractmethod, ABC
from dataclasses import dataclass
from queue import SimpleQueue, Empty as QueueEmpty
+from sys import exception as sys_exception
from threading import Thread
from typing import Any, Iterator, Literal, Self
@dataclass
class ExceptionEvent(Event):
'To deliver Exception to main loop for handling.'
- exception: CrashingException
+
+ def __init__(self, e: CrashingException, *args, **kwargs):
+ tracebackable = sys_exception()
+ self.exception = e.with_traceback(tracebackable.__traceback__
+ if tracebackable else None)
+ super().__init__(*args, **kwargs)
@dataclass