Skip to content

Commit

Permalink
Make error messages for missing AppInst more clear
Browse files Browse the repository at this point in the history
b/c find_installation() searches on the current tenant only!
  • Loading branch information
atodorov committed Aug 26, 2020
1 parent 1f18a2b commit 3ee976e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tcms_github_app/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def _rpc_connection(self):
installations = utils.find_installations(self.request)

if installations.count() != 1:
raise Exception('Cannot find GitHub App installation')
raise Exception(
'Cannot find GitHub App installation for tenant "%s"' % self.request.tenant.name)

installation = installations.first()

Expand Down
5 changes: 1 addition & 4 deletions tcms_github_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,10 @@ def get(self, request, *args, **kwargs):
installations = utils.find_installations(request)

if installations.count() == 0:
github_url = 'https://github.com/apps/kiwi-tcms'
messages.add_message(
request,
messages.WARNING,
_(
'You have not installed Kiwi TCMS into your GitHub account! '
'<a href="%s">Click here</a>!' % github_url),
_('Cannot find GitHub App installation for tenant "%s"' % request.tenant.name),
)
return HttpResponseRedirect('/')

Expand Down

0 comments on commit 3ee976e

Please sign in to comment.