Skip to content

Commit

Permalink
fix for issue anaconda#501
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Costa authored and dzelge committed Jul 11, 2019
1 parent b276f05 commit 2cb8d59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions binstar_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,19 @@ def _check_response(self, res, allowed=[200]):
except:
pass
else:
msg = data.get('error', msg)
msg += '\n' + data['error'] if data.get('error', None) else ''

ErrCls = errors.BinstarError
ErrCls = errors.BinstarError(msg)
if res.status_code == 401:
ErrCls = errors.Unauthorized
ErrCls = errors.Unauthorized(msg)
elif res.status_code == 404:
ErrCls = errors.NotFound
ErrCls = errors.NotFound(msg)
elif res.status_code == 409:
ErrCls = errors.Conflict
ErrCls = errors.Conflict(msg)
elif res.status_code >= 500:
ErrCls = errors.ServerError
ErrCls = errors.ServerError(msg)

raise ErrCls(msg, res.status_code)
raise ErrCls

def user(self, login=None):
'''
Expand Down
2 changes: 1 addition & 1 deletion binstar_client/scripts/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def file_or_token(value):

def _custom_excepthook(logger, show_traceback=False):
def excepthook(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt) or not issubclass(exc_type, errors.ServerError):
if issubclass(exc_type, KeyboardInterrupt):
return

if show_traceback:
Expand Down

0 comments on commit 2cb8d59

Please sign in to comment.