Skip to content

Commit

Permalink
Fix MultiContext exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BjarniRunar committed Oct 23, 2014
1 parent c8ec2ae commit cbe7b88
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mailpile/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,14 @@ def __enter__(self, *args, **kwargs):
return self

def __exit__(self, *args, **kwargs):
raised = []
for ctx in reversed(self.contexts):
ctx.__exit__(*args, **kwargs)
try:
ctx.__exit__(*args, **kwargs)
except Exception as e:
raised.append(e)
if raised:
raise raised[0]


def FixupForWith(obj):
Expand Down

0 comments on commit cbe7b88

Please sign in to comment.