From 9c369a448595ee674c4089f3a5e3a73eee341a4f Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Tue, 7 May 2019 12:03:00 +0000 Subject: [PATCH] [FIX] google_account: log error message on screen Include the Google Error message in the error message showed on screen. Fine tuning of da13c70484 : missing transiflex translations, empty body, wrong string format. opw-1966309 closes odoo/odoo#33216 Signed-off-by: Lucas Perais (lpe) --- addons/google_account/i18n/google_account.pot | 10 ++++++++-- addons/google_account/models/google_service.py | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/google_account/i18n/google_account.pot b/addons/google_account/i18n/google_account.pot index b3fbce69eba..c417f0ab441 100644 --- a/addons/google_account/i18n/google_account.pot +++ b/addons/google_account/i18n/google_account.pot @@ -30,6 +30,12 @@ msgstr "" msgid "Display Name" msgstr "" +#. module: google_account +#: code:addons/google_account/models/google_service.py:196 +#, python-format +msgid "Error while requesting Google Services: %s" +msgstr "" + #. module: google_account #: model:ir.model,name:google_account.model_google_service msgid "Google Service" @@ -80,9 +86,9 @@ msgid "Something went wrong during your token generation. Maybe your Authorizati msgstr "" #. module: google_account -#: code:addons/google_account/models/google_service.py:193 +#: code:addons/google_account/models/google_service.py:197 #, python-format -msgid "Something went wrong with your request to google" +msgid "Something went wrong with your request to google: %s" msgstr "" #. module: google_account diff --git a/addons/google_account/models/google_service.py b/addons/google_account/models/google_service.py index 5292a490515..fb9213f96b2 100644 --- a/addons/google_account/models/google_service.py +++ b/addons/google_account/models/google_service.py @@ -189,12 +189,12 @@ class GoogleService(models.TransientModel): status = error.response.status_code response = "" else: - req = json.loads(error.request.body) + req = json.loads(error.request.body or 'null') res = error.response.json() _logger.exception("Error while requesting Google Services\nRequest:\n%s\nResponse:\n%s", pformat(req), pformat(res)) if error.response.status_code in (400, 401, 410): - raise UserError(_("Error while requesting Google Services: %s" % res['error']['message'])) - raise self.env['res.config.settings'].get_config_warning(_("Something went wrong with your request to google")) + raise UserError(_("Error while requesting Google Services: %s") % res['error']['message']) + raise self.env['res.config.settings'].get_config_warning(_("Something went wrong with your request to google: %s") % res['error']['message']) return (status, response, ask_time) # TODO : remove me, it is only used in google calendar. Make google_calendar use the constants