diff options
| author | Martin Trigaux <mat@odoo.com> | 2019-07-12 13:09:45 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-07-12 13:59:35 +0000 |
| commit | 1f5a4649a67908ecb6acfec37673c8149de0471f (patch) | |
| tree | 2a8ac12942b2e6227459a236309054982a01158f /addons/google_account | |
| parent | 6532b8716520d8cddc23a1e42c5c602b0c9c3c88 (diff) | |
| parent | 87fc1554d6a1823ac9061aab089adfd052190d21 (diff) | |
[MERGE] Forward port of saas-12.3 to saas-12.4 up to 87fc1554d6a1823
closes odoo/odoo#34820
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/google_account')
| -rw-r--r-- | addons/google_account/models/google_service.py | 22 |
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 |
