Skip to content

Commit

Permalink
excs
Browse files Browse the repository at this point in the history
  • Loading branch information
akatrevorjay committed Dec 10, 2018
1 parent 21080a8 commit 61178b9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pytutils/excs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from contextlib import contextmanager


@contextmanager
def ok(*exceptions):
"""Context manager to pass exceptions.
:param exceptions: Exceptions to pass
"""
try:
yield
except Exception as e:
if isinstance(e, exceptions):
pass
else:
raise e

0 comments on commit 61178b9

Please sign in to comment.