Catch team member invite missing exception

Fixes https://sentry.io/coreos/backend-production/issues/195926082/
This commit is contained in:
Joseph Schorr 2017-02-21 10:55:31 -05:00
parent fd4a31d3c3
commit 89b7c13da5
2 changed files with 9 additions and 2 deletions

View file

@ -257,8 +257,13 @@ def get_organization_team_member_invites(teamid):
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()
return True
def delete_team_user_invite(team, user_obj):

View file

@ -347,7 +347,9 @@ class InviteTeamMember(ApiResource):
raise NotFound()
# 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, {
'email': email,
'team': teamname,