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

Commit

Permalink
Correct handling of error on create_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Feb 17, 2016
1 parent 934de0c commit 8ed61df
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sentry_jira/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,16 @@ def create_issue(self, request, group, form_data, **kwargs):
try:
issue_response = jira_client.create_issue(form_data)
except JIRAError as e:
issue_response = e.response
# return some sort of error.
errdict = {"__all__": None}
if issue_response.status_code == 500:
if e.status_code == 500:
errdict["__all__"] = ["JIRA Internal Server Error."]
elif issue_response.status_code == 400:
for k in issue_response.json["errors"].keys():
errdict[k] = [issue_response.json["errors"][k]]
errdict["__all__"] = [issue_response.json["errorMessages"]]
elif e.status_code == 400:
for k in e.json["errors"].keys():
errdict[k] = [e.json["errors"][k]]
errdict["__all__"] = [e.json["errorMessages"]]
else:
errdict["__all__"] = ["Something went wrong, Sounds like a configuration issue: code %s" % issue_response.status_code]
errdict["__all__"] = ["Something went wrong, Sounds like a configuration issue: code %s" % e.status_code]
return None, errdict
else:
return issue_response.json.get("key"), None
Expand Down

0 comments on commit 8ed61df

Please sign in to comment.