Skip to content

Commit 2ab1933

Browse files
committed
Allow retrieving exception
1 parent 429c76d commit 2ab1933

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ipykernel/thread.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def __init__(self, **kwargs):
2525
self.is_pydev_daemon_thread = True
2626
self._tasks: Queue[tuple[str, Callable[[], Awaitable[Any]]] | None] = Queue()
2727
self._result: Queue[Any] = Queue()
28+
self._exception: Exception | None = None
29+
30+
@property
31+
def exception(self) -> Exception | None:
32+
return self._exception
2833

2934
@property
3035
def task_group(self) -> TaskGroup:
@@ -45,8 +50,8 @@ def run(self) -> None:
4550
"""Run the thread."""
4651
try:
4752
run(self._main)
48-
except Exception:
49-
pass
53+
except Exception as exc:
54+
self._exception = exc
5055

5156
async def _main(self) -> None:
5257
async with create_task_group() as tg:

0 commit comments

Comments
 (0)