Skip to content

Commit

Permalink
Catch proper exception
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Nov 29, 2024
1 parent 2387d30 commit 680cc19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/account_linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Optional

import arrow
import sqlalchemy.exc
from arrow import Arrow
from newrelic import agent
from psycopg2.errors import UniqueViolation
Expand Down Expand Up @@ -192,7 +193,8 @@ def process(self) -> LinkResult:
user=new_user,
strategy=self.__class__.__name__,
)
except UniqueViolation:
except (UniqueViolation, sqlalchemy.exc.IntegrityError) as e:
LOG.debug(f"Got the duplicate user error: {e}")
return self.create_missing_link(canonical_email)

def create_missing_link(self, canonical_email: str):
Expand Down

0 comments on commit 680cc19

Please sign in to comment.