Created
January 5, 2018 17:09
-
-
Save bhyde/a4552b1b197296a1d72bf4319c055fbd to your computer and use it in GitHub Desktop.
context manager for boto3 ClientError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@contextmanager | |
def ignoring_aws_client_error(code-text): | |
try: | |
yield | |
except ClientError as e: | |
if e.response['Error']['Code'] == code-text: | |
pass | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment