Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
handle another format for jira api validation errors (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
macqueen authored Nov 2, 2016
1 parent 96eadf3 commit 1ba6381
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sentry_plugins/jira/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,16 @@ def message_from_error(self, exc):
if isinstance(exc, JIRAUnauthorized):
return ERR_UNAUTHORIZED
elif isinstance(exc, JIRAError):
message = 'unknown error'
message = ''
if exc.json and exc.json.get('errorMessages'):
message = ' '.join(exc.json['errorMessages'])
if exc.json and exc.json.get('errors'):
if message:
message += ' '
message += ' '.join(['%s: %s' % (k, v) for k, v in exc.json.get('errors').items()])
return ('Error Communicating with Jira (HTTP %s): %s' % (
exc.status_code,
message,
message or 'unknown error',
))
else:
return ERR_INTERNAL
Expand Down

0 comments on commit 1ba6381

Please sign in to comment.