From 3624a071031fda510f606faa683b5091f1135971 Mon Sep 17 00:00:00 2001
From: std-odoo <std@odoo.com>
Date: Thu, 9 Feb 2023 08:17:02 +0000
Subject: [PATCH] [FIX] google_gmail: fix google gmail oauth crashing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Bug
===
When an error occurs, the error received is wrongly stringified.

closes odoo/odoo#112290

X-original-commit: 1bf9278be543978350bc97a1166da16057015e45
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
---
 addons/google_gmail/controllers/main.py   | 6 +++---
 addons/google_gmail/i18n/google_gmail.pot | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/addons/google_gmail/controllers/main.py b/addons/google_gmail/controllers/main.py
index 224470e26621..f9bf00d9008b 100644
--- a/addons/google_gmail/controllers/main.py
+++ b/addons/google_gmail/controllers/main.py
@@ -29,7 +29,7 @@ class GoogleGmailController(http.Controller):
             raise Forbidden()
 
         if error:
-            return _('An error occur during the authentication process: %s.') % error
+            return _('An error occur during the authentication process.')
 
         try:
             state = json.loads(state)
@@ -56,8 +56,8 @@ class GoogleGmailController(http.Controller):
 
         try:
             refresh_token, access_token, expiration = record._fetch_gmail_refresh_token(code)
-        except UserError as e:
-            return _('An error occur during the authentication process: %s.') % str(e.name)
+        except UserError:
+            return _('An error occur during the authentication process.')
 
         record.write({
             'google_gmail_access_token': access_token,
diff --git a/addons/google_gmail/i18n/google_gmail.pot b/addons/google_gmail/i18n/google_gmail.pot
index 9a4f8508d29d..91eed151227c 100644
--- a/addons/google_gmail/i18n/google_gmail.pot
+++ b/addons/google_gmail/i18n/google_gmail.pot
@@ -58,7 +58,7 @@ msgstr ""
 #: code:addons/google_gmail/controllers/main.py:0
 #: code:addons/google_gmail/controllers/main.py:0
 #, python-format
-msgid "An error occur during the authentication process: %s."
+msgid "An error occur during the authentication process."
 msgstr ""
 
 #. module: google_gmail
-- 
GitLab