summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorRomain Estievenart <res@odoo.com>2021-01-21 12:16:19 +0000
committerRomain Estievenart <res@odoo.com>2021-01-22 12:23:15 +0000
commitf54c97f6214c235bac931184c6e533a7fa72fbe2 (patch)
tree724d2b24667c3ade4529b8e35169b0376009f224 /odoo
parentd6f27d568377ba23d859fefe02a33b07c678b233 (diff)
[FIX] http.py: exception handling parity in mono/multi db
The mobile app's authentication bases its feedback to the user on the error message returned by the server. Sadly, in case of multi-databases, no error message are properly returned when the user provides wrong credentials (presenting only an empty Snackbar). This difference of behaviour was introduced in the commit odoo/odoo@07d5ea3 which goals was to give more power for JsonRequest's error handling customization. To do so, the catching of the exception (if one happens) was delegated to the caller instead of the JsonRequest itself. This change indirectly introduced a difference about the treatment of an exception between mono and multi-database : * mono-database was already catching the exception and handling it properly (see in https://github.com/odoo/odoo/blob/f05f8ef647a4eaba49d8a20eb8068f1c7a702297/odoo/addons/base/models/ir_http.py#L235-L241). * multi-databases didn't catch it. This commit restores the parity between both use cases by applying the same behaviour (as described in the commit odoo/odoo@07d5ea3): ```python ir_http.dispatch(): try: request.dispatch() catch Exception as e: ir_http._handle_exception(e) ir_http.handle_exception(e) request._handle_exception(e) ``` Steps to reproduce: 1. Open the mobile app; 2. Try to register an account with a wrong password with multiple databases; 3. The snackbar is empty and no error is shown => bug; Task ID: 2287176 closes odoo/odoo#64856 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Diffstat (limited to 'odoo')
-rw-r--r--odoo/http.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/odoo/http.py b/odoo/http.py
index 3f6a3af6290..312a455834b 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -1437,7 +1437,10 @@ class Root(object):
except werkzeug.exceptions.HTTPException as e:
return request._handle_exception(e)
request.set_handler(func, arguments, "none")
- result = request.dispatch()
+ try:
+ result = request.dispatch()
+ except Exception as e:
+ return request._handle_exception(e)
return result
with request: