From b4993b5a9b5fc7cd291180afb593eae8ea5d423a Mon Sep 17 00:00:00 2001 From: shri Date: Mon, 11 Nov 2024 19:38:24 +0100 Subject: [PATCH] Handle bad birthdates --- src/app/domain/opportunities/services.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/domain/opportunities/services.py b/src/app/domain/opportunities/services.py index 61ad9084..2bc09744 100644 --- a/src/app/domain/opportunities/services.py +++ b/src/app/domain/opportunities/services.py @@ -374,7 +374,14 @@ async def scan( if person_details.get("github_url"): github_profile_url = "https://" + person_details.get("github_url").rstrip("/") if person_details.get("birth_date"): - birth_date = datetime.strptime(person_details.get("birth_date"), "%Y-%m-%d").date() + try: + birth_date = datetime.strptime(person_details.get("birth_date"), "%Y-%m-%d").date() + except Exception as e: + logger.warn( + "Failed to parse birth date for a person", + person_details=person_details, + exc_info=e, + ) if person_details.get("work_email"): if get_domain_from_email(person_details.get("work_email", "")) == get_domain(