Skip to content

Instantly share code, notes, and snippets.

@bhyde
Created January 5, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhyde/a4552b1b197296a1d72bf4319c055fbd to your computer and use it in GitHub Desktop.
Save bhyde/a4552b1b197296a1d72bf4319c055fbd to your computer and use it in GitHub Desktop.
context manager for boto3 ClientError
@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