Skip to content

Commit

Permalink
fix: only format exception for primary context (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Apr 10, 2023
1 parent 70f5003 commit 265f632
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/awkward/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __enter__(self):
def __exit__(self, exception_type, exception_value, traceback):
try:
# Handle caught exception
if exception_type is not None:
if exception_type is not None and self.primary() is self:
self.handle_exception(exception_type, exception_value)
finally:
# Step out of the way so that another ErrorContext can become primary.
Expand All @@ -59,7 +59,7 @@ def __exit__(self, exception_type, exception_value, traceback):

def handle_exception(self, cls: type[E], exception: E) -> E:
if sys.version_info >= (3, 11, 0, "final"):
return self.decorate_exception(cls, exception)
self.decorate_exception(cls, exception)
else:
raise self.decorate_exception(cls, exception)

Expand Down

0 comments on commit 265f632

Please sign in to comment.