summaryrefslogtreecommitdiff
path: root/odoo/http.py
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-06-11 12:26:45 +0000
committerfja-odoo <fja@odoo.com>2019-06-28 08:53:52 +0000
commitf8fe314e786d2100833ecc8b0cb661252f648ddc (patch)
tree0198886f7856f105a0654bfbb95154e0e9804341 /odoo/http.py
parente6d4ab84da7a1031ab552b4a6b3fc4aa2348163e (diff)
[IMP] web, *: display warning/error in frontend
* = account, iap, point_of_sale Removing the CrashManager templates from base.xml and moving it to a new file (crash_manager.xml) to allow lazy loading the required xml only when a crash occurs (necessary for the frontend as no xml is pre-loaded). All rpc errors/warnings are now displayed using the same modal system as the backend (crash_manager.js). CrashManager will now return the WarningDialog and ErrorDialog in addition to the CrashManager itself. In some cases an instance of CrashManager was created just to display a warning/error dialog. In the backend all rpc errors but sessionExpired will be logged. If the exception is a warning, NotFound (403) or except_orm, it will be a warning log. The rest will be exception log. In the frontend all rpc errors will be logged using console.debug instead of console.warn and console.error. This way we can trigger rpc errors in tests without failing them. If a real error happend during a test it will fall back on the backend logger to fail the test. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
Diffstat (limited to 'odoo/http.py')
-rw-r--r--odoo/http.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/odoo/http.py b/odoo/http.py
index 8702fd9a950..ab4512a6321 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -630,13 +630,18 @@ class JsonRequest(WebRequest):
try:
return super(JsonRequest, self)._handle_exception(exception)
except Exception:
- if not isinstance(exception, (odoo.exceptions.Warning, SessionExpiredException,
- odoo.exceptions.except_orm, werkzeug.exceptions.NotFound)):
- _logger.exception("Exception during JSON request handling.")
+ if not isinstance(exception, SessionExpiredException):
+ if exception.args and exception.args[0] == "bus.Bus not available in test mode":
+ _logger.info(exception)
+ elif isinstance(exception, (odoo.exceptions.Warning, odoo.exceptions.except_orm,
+ werkzeug.exceptions.NotFound)):
+ _logger.warning(exception)
+ else:
+ _logger.exception("Exception during JSON request handling.")
error = {
- 'code': 200,
- 'message': "Odoo Server Error",
- 'data': serialize_exception(exception)
+ 'code': 200,
+ 'message': "Odoo Server Error",
+ 'data': serialize_exception(exception),
}
if isinstance(exception, werkzeug.exceptions.NotFound):
error['http_status'] = 404
@@ -1414,7 +1419,7 @@ class Root(object):
httprequest = werkzeug.wrappers.Request(environ)
httprequest.app = self
httprequest.parameter_storage_class = werkzeug.datastructures.ImmutableOrderedMultiDict
-
+
current_thread = threading.current_thread()
current_thread.url = httprequest.url
current_thread.query_count = 0