Skip to content

Commit

Permalink
fixup! driveby: Catch multiple unhandled
Browse files Browse the repository at this point in the history
  • Loading branch information
gjoseph92 committed May 13, 2022
1 parent bbfff7c commit 40e37fa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3657,13 +3657,7 @@ def catch_unhandled_exceptions() -> Generator[None, None, None]:

@loop.set_exception_handler
def _(loop: object, context: dict[str, Any]) -> None:
if exc := context.get("exception"):
tb = "\n".join(
traceback.format_exception(type(exc), exc, exc.__traceback__)
)
else:
tb = None
ctxs.append({"message": context["message"], "tb": tb})
ctxs.append(context)

try:
yield
Expand All @@ -3676,8 +3670,9 @@ def _(loop: object, context: dict[str, Any]) -> None:
print(
f"------ Unhandled exception {i}/{len(ctxs)}: {ctx['message']!r} ------"
)
if tb := ctx["tb"]:
print(tb)
print(ctx)
if exc := ctx.get("exception"):
traceback.print_exception(type(exc), exc, exc.__traceback__)

raise UnhandledExceptions(", ".join(msgs))

Expand Down

0 comments on commit 40e37fa

Please sign in to comment.