log(email_routes): add warnings to silent except Exception blocks

- Email alias resolution failure now logs a warning instead of silently
  returning an empty list, making broken account configs diagnosable.
This commit is contained in:
NoodleLDS
2026-06-02 18:56:51 -03:00
committed by Alexandre Teixeira
parent 7d1abdbe69
commit 6b5feb0e64
+4 -3
View File
@@ -79,15 +79,16 @@ def _email_tag_owner_aliases(account_id: str | None, owner: str = "") -> list[st
cfg.get("smtp_user") or "", cfg.get("smtp_user") or "",
cfg.get("from_address") or "", cfg.get("from_address") or "",
]) ])
except Exception: except Exception as _e:
logger.warning("Failed to resolve email account alias: %s", _e)
resolved_account_id = None resolved_account_id = None
row = db.get(_EA, resolved_account_id) if resolved_account_id else None row = db.get(_EA, resolved_account_id) if resolved_account_id else None
if row: if row:
aliases.extend([row.owner or "", row.imap_user or "", row.from_address or ""]) aliases.extend([row.owner or "", row.imap_user or "", row.from_address or ""])
finally: finally:
db.close() db.close()
except Exception: except Exception as _e:
pass logger.warning("Failed to load email aliases: %s", _e)
out = [] out = []
for a in aliases: for a in aliases:
a = (a or "").strip() a = (a or "").strip()