In backend/accounts/tasks.py, the current code uses:
email_obj = AccountEmail.objects.filter(id=email_obj_id).first()
This silently returns None if the object is not found, making it
hard to debug failures in production.
Suggested fix:
try:
email_obj = AccountEmail.objects.get(id=email_obj_id)
except AccountEmail.DoesNotExist:
logger.error(f"AccountEmail id={email_obj_id} not found, skipping task.")
return
This way, missing objects are logged properly instead of failing silently.
In
backend/accounts/tasks.py, the current code uses:email_obj = AccountEmail.objects.filter(id=email_obj_id).first()
This silently returns None if the object is not found, making it
hard to debug failures in production.
Suggested fix:
try:
email_obj = AccountEmail.objects.get(id=email_obj_id)
except AccountEmail.DoesNotExist:
logger.error(f"AccountEmail id={email_obj_id} not found, skipping task.")
return
This way, missing objects are logged properly instead of failing silently.