summaryrefslogtreecommitdiff
path: root/addons/iap/models
diff options
context:
space:
mode:
authorRémi Rahir <rar@odoo.com>2017-10-18 16:45:55 +0200
committerRémi Rahir <rar@odoo.com>2017-10-18 17:08:21 +0200
commit47b8887ff5fd2904d542da8563dcbfb6bcf92dc3 (patch)
tree1d6d0173fbd0836db62526461299b5f2a52a2afe /addons/iap/models
parent542b8fd5505e6a10d0e6cfcf3bd45b0967d8ef6b (diff)
[FIX] iap_odoo: fix error general error raise
Errors that are not whitelisted are not managed correctly due to the jsonrpc behaviour in Odoo. When we make a post in json using iap.jsonrpc function, it contacts iap.odoo.com. However, if this url does not respond, it falls back to the 'typo' page and the answer to the call has a '200' status code but with an 'error' key in its response. Currently, we manage the errors via whitelisting, which hides this kind of errors. We opted to raise this error (odoo server side) as a UserError and to add UserError to the whitelist.
Diffstat (limited to 'addons/iap/models')
-rw-r--r--addons/iap/models/iap.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py
index 659ea1974c5..37f760e385e 100644
--- a/addons/iap/models/iap.py
+++ b/addons/iap/models/iap.py
@@ -57,8 +57,10 @@ def jsonrpc(url, method='call', params=None):
e_class = InsufficientCreditError
elif name == 'AccessError':
e_class = exceptions.AccessError
- else:
+ elif name == 'UserError':
e_class = exceptions.UserError
+ else:
+ raise requests.exceptions.ConnectionError()
e = e_class(message)
e.data = response['error']['data']
raise e