refactor: Replace direct logger.error calls with capture_and_log in accounts services and conditionally pass error_id during ApplicationError creation.

This commit is contained in:
pacnpal
2026-01-04 18:36:23 -05:00
parent 95700c7d7b
commit bc4a3c7557
6 changed files with 40 additions and 27 deletions

View File

@@ -17,6 +17,7 @@ from django.utils import timezone
from django_forwardemail.services import EmailService
from apps.accounts.models import NotificationPreference, User, UserNotification
from apps.core.utils import capture_and_log
logger = logging.getLogger(__name__)
@@ -264,7 +265,7 @@ class NotificationService:
logger.info(f"Email notification sent to {user.email} for notification {notification.id}")
except Exception as e:
logger.error(f"Failed to send email notification {notification.id}: {str(e)}")
capture_and_log(e, f'Send email notification {notification.id}', source='service')
@staticmethod
def get_user_notifications(