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

Commit

Permalink
Gracefully handle no projects available
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Feb 29, 2016
1 parent b056144 commit 6c05262
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion sentry_jira/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def __init__(self, data=None, *args, **kwargs):
has_credentials = False
can_auto_create = False
else:
self.fields["default_issue_type"].choices = JIRAFormUtils.make_choices(meta["issuetypes"])
if meta:
self.fields["default_issue_type"].choices = JIRAFormUtils.make_choices(meta["issuetypes"])
else:
can_auto_create = False

if not has_credentials:
self.fields['password'].required = True
Expand Down
5 changes: 4 additions & 1 deletion sentry_jira/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def get_create_meta_for_project(self, project):
if len(metas["projects"]) > 1:
raise JIRAError("More than one project found.")

return metas["projects"][0]
try:
return metas["projects"][0]
except IndexError:
return None

def get_versions(self, project):
return self.get_cached(self.VERSIONS_URL % project)
Expand Down

0 comments on commit 6c05262

Please sign in to comment.