def boto3_exception_handler(f):
"""Capture and pretty print exceptions"""
@wraps(f)
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except (botocore.exceptions.ClientError,
botocore.exceptions.WaiterError,
botocore.exceptions.ParamValidationError,
ConfigError) as e:
click.secho(str(e), fg='red')
except KeyboardInterrupt as e:
click.secho('Aborted.', fg='red')
return wrapper
评论列表
文章目录