[FIX] iap: handle HTTPErrror and Timeout when contacting iap server

When the iap sever is called, it is possible that the request timeout
or that the webserver returns an error code (if the Odoo server is down
for example) and we should warn the user instead of throwing an
exception in a traceback

closes odoo/odoo#29667
This commit is contained in:
Pierre Masereel
2018-12-21 12:38:36 +00:00
parent f76a45a9d3
commit 696269bbc7
+1 -1
View File
@@ -66,7 +66,7 @@ def jsonrpc(url, method='call', params=None):
e.data = response['error']['data']
raise e
return response.get('result')
except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema) as e:
except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema, requests.exceptions.Timeout, requests.exceptions.HTTPError) as e:
raise exceptions.AccessError('The url that this service requested returned an error. Please contact the author the app. The url it tried to contact was ' + url)
#----------------------------------------------------------