🩹(backend) replace requests exception with urllib3 ones

My bad, I caught the wrong exception, issue is still raising in Sentry.
It fixes commit #2a7d963f
This commit is contained in:
lebaudantoine
2025-05-28 10:46:34 +02:00
committed by aleb_the_flash
parent 0c6cd8223d
commit 61aa3c79c5
2 changed files with 11 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
import brevo_python
import requests
import urllib3
logger = logging.getLogger(__name__)
@@ -121,7 +121,10 @@ class BrevoMarketingService:
try:
response = contact_api.create_contact(contact, **api_configurations)
except (brevo_python.rest.ApiException, requests.exceptions.ReadTimeout) as err:
except (
brevo_python.rest.ApiException,
urllib3.exceptions.ReadTimeoutError,
) as err:
logger.warning("Failed to create contact in Brevo", exc_info=True)
raise ContactCreationError("Failed to create contact in Brevo") from err