Catch team member invite missing exception
Fixes https://sentry.io/coreos/backend-production/issues/195926082/
This commit is contained in:
parent
fd4a31d3c3
commit
89b7c13da5
2 changed files with 9 additions and 2 deletions
|
@ -257,8 +257,13 @@ def get_organization_team_member_invites(teamid):
|
||||||
|
|
||||||
|
|
||||||
def delete_team_email_invite(team, email):
|
def delete_team_email_invite(team, email):
|
||||||
found = TeamMemberInvite.get(TeamMemberInvite.email == email, TeamMemberInvite.team == team)
|
try:
|
||||||
|
found = TeamMemberInvite.get(TeamMemberInvite.email == email, TeamMemberInvite.team == team)
|
||||||
|
except TeamMemberInvite.DoesNotExist:
|
||||||
|
return False
|
||||||
|
|
||||||
found.delete_instance()
|
found.delete_instance()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def delete_team_user_invite(team, user_obj):
|
def delete_team_user_invite(team, user_obj):
|
||||||
|
|
|
@ -347,7 +347,9 @@ class InviteTeamMember(ApiResource):
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
|
|
||||||
# Delete the invite.
|
# Delete the invite.
|
||||||
model.team.delete_team_email_invite(team, email)
|
if not model.team.delete_team_email_invite(team, email):
|
||||||
|
raise NotFound()
|
||||||
|
|
||||||
log_action('org_delete_team_member_invite', orgname, {
|
log_action('org_delete_team_member_invite', orgname, {
|
||||||
'email': email,
|
'email': email,
|
||||||
'team': teamname,
|
'team': teamname,
|
||||||
|
|
Reference in a new issue