def eat_exceptions(function):
@six.wraps(function)
def decorator(*args, **kwargs):
try:
return function(*args, **kwargs)
except HTTPError as exception:
if exception.response.status_code == 401:
error_and_quit('Your authentication information may be incorrect. Please '
'reconfigure with ``dbfs configure``')
else:
error_and_quit(exception.response.content)
except Exception as exception: # noqa
if not DEBUG_MODE:
error_and_quit('{}: {}'.format(type(exception).__name__, str(exception)))
decorator.__doc__ = function.__doc__
return decorator
评论列表
文章目录