File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,15 @@ def replace_users_emails_with_mention(text: str) -> str:
164164 email_pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
165165 matches = re .findall (email_pattern , text )
166166 for email in matches :
167- response = client .users_lookupByEmail (email = email )
167+ try :
168+ response = client .users_lookupByEmail (email = email )
169+ # It's okay to catch all exceptions here since we don't want to fail the entire
170+ # operation if one email lookup fails.
171+ except Exception as e : # pylint: disable=broad-except
172+ logger .info (
173+ "replace_users_emails_with_mention_failed" , extra = {"error" : str (e )}
174+ )
175+ response = None
168176 if response :
169177 user : dict = response .get ("user" , {})
170178 user_handle = user .get ("id" )
You can’t perform that action at this time.
0 commit comments