summaryrefslogtreecommitdiff
path: root/addons/google_account
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-07-05 16:14:48 +0200
committerChristophe Simonis <chs@odoo.com>2019-07-05 16:14:48 +0200
commit66bb578ac9f0cc260a5b7f859fc0bb4fcfab6e25 (patch)
tree57b147168f7118374f0f5b4ba46f4c9d75220df2 /addons/google_account
parent201c5b5878f13c34cb7a9edb3c3296fc9a1944fe (diff)
parentbe5e8fdab800ff1fd9e953ec64801f96bcc3dac5 (diff)
[MERGE] forward port branch saas-12.2 up to be5e8fdab80
Diffstat (limited to 'addons/google_account')
-rw-r--r--addons/google_account/models/google_service.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/addons/google_account/models/google_service.py b/addons/google_account/models/google_service.py
index aa3040d7947..1797dd66bea 100644
--- a/addons/google_account/models/google_service.py
+++ b/addons/google_account/models/google_service.py
@@ -2,7 +2,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
-from pprint import pformat
import json
import logging
@@ -184,29 +183,14 @@ class GoogleService(models.TransientModel):
except:
pass
except requests.HTTPError as error:
- # https://developers.google.com/calendar/v3/errors
if error.response.status_code in (204, 404):
status = error.response.status_code
response = ""
else:
- try:
- exception_req = pformat(json.loads(error.request.body))
- except:
- exception_req = error.request.body
-
- try:
- exception_res = pformat(error.response.json())
- error_msg = _("Error while requesting Google Services: %s") % res['error']['message']
- warning_msg = _("Something went wrong with your request to google: %s") % res['error']['message']
- except:
- exception_res = error.response.text
- error_msg = _("Error while requesting Google Services")
- warning_msg = _("Something went wrong with your request to google")
-
- _logger.exception("Error while requesting Google Services\nRequest:\n%s\nResponse:\n%s", exception_req, exception_res)
+ _logger.exception("Bad google request : %s !", error.response.content)
if error.response.status_code in (400, 401, 410):
- raise UserError(error_msg)
- raise self.env['res.config.settings'].get_config_warning(warning_msg)
+ raise error
+ raise self.env['res.config.settings'].get_config_warning(_("Something went wrong with your request to google"))
return (status, response, ask_time)
# TODO : remove me, it is only used in google calendar. Make google_calendar use the constants