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
This commit is contained in:
Kaushal Shriwas 2026-02-06 12:09:51 +05:30 committed by GitHub
parent db9a4e9086
commit b39800e5aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,7 +65,16 @@ class Oauth:
) )
if not res.startswith(b"+OK"): 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: def _connect_imap(self) -> None:
self._conn.authenticate(self._mechanism, lambda x: self._auth_string) self._conn.authenticate(self._mechanism, lambda x: self._auth_string)