summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2018-07-12 10:23:40 +0200
committerXavier Morel <xmo@odoo.com>2018-07-13 17:31:23 +0200
commit233874d5efa00529a6d23a33a8b0b75d535e1950 (patch)
treececbb47a462a5b88a23a5f4556c30ab68e900691 /addons/web/static/src
parent35d452cffbb1554c70f0acba85dfc4ef472f544c (diff)
[IMP] web: use builtin crash manager hooks for special handling
* having a special case for session expiration seems unnecessary when the CM specifically supports hooking on the exception name * and properly implement the special handling of HTTP 504 (Gateway Timeout) from #24854 using that same hook
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/services/crash_manager.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js
index f3bfa87341c..a5b8cb32c13 100644
--- a/addons/web/static/src/js/services/crash_manager.js
+++ b/addons/web/static/src/js/services/crash_manager.js
@@ -55,10 +55,6 @@ var CrashManager = core.Class.extend({
new (handler)(this, error).display();
return;
}
- if (error.data.name === "odoo.http.SessionExpiredException" || error.data.name === "werkzeug.exceptions.Forbidden") {
- this.show_warning({type: _t("Odoo Session Expired"), data: {message: _t("Your Odoo session expired. Please refresh the current web page.")}});
- return;
- }
if (_.has(map_title, error.data.exception_type)) {
if(error.data.exception_type === 'except_orm'){
if(error.data.arguments[1]) {
@@ -210,6 +206,26 @@ var RedirectWarningHandler = Dialog.extend(ExceptionHandler, {
core.crash_registry.add('odoo.exceptions.RedirectWarning', RedirectWarningHandler);
+function session_expired(cm) {
+ return {
+ display: function () {
+ cm.show_warning({type: _t("Odoo Session Expired"), data: {message: _t("Your Odoo session expired. Please refresh the current web page.")}});
+ }
+ }
+}
+core.crash_registry.add('odoo.http.SessionExpiredException', session_expired);
+core.crash_registry.add('werkzeug.exceptions.Forbidden', session_expired);
+
+core.crash_registry.add('504', function (cm) {
+ return {
+ display: function () {
+ cm.show_warning({
+ type: _t("Request timeout"),
+ data: {message: _t("The operation was interrupted. This usually means that the current operation is taking too much time.")}});
+ }
+ }
+});
+
return CrashManager;
});