From b39800e5aa5f831f8a55d9261a531440131fa2e0 Mon Sep 17 00:00:00 2001 From: Kaushal Shriwas <64089478+kaulith@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:09:51 +0530 Subject: [PATCH] fix: replace bare raise statement with AuthenticationError in oauth.py (#36729) * fix: replace bare raise statement with AuthenticationError in oauth.py * fix: add error log --- frappe/email/oauth.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frappe/email/oauth.py b/frappe/email/oauth.py index 497ee65d45..b87839466f 100644 --- a/frappe/email/oauth.py +++ b/frappe/email/oauth.py @@ -65,7 +65,16 @@ class Oauth: ) if not res.startswith(b"+OK"): - raise + frappe.log_error( + title="POP3 OAuth Authentication Failed", + message=f"Response: {res}", + reference_doctype="Email Account", + reference_name=self.email_account, + ) + frappe.throw( + frappe._("POP3 OAuth authentication failed for Email Account {0}").format(self.email_account), + frappe.AuthenticationError, + ) def _connect_imap(self) -> None: self._conn.authenticate(self._mechanism, lambda x: self._auth_string)