diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-01-30 16:25:52 +0100 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-01-30 16:25:52 +0100 |
| commit | 4776ea75ebd01886f43d68b0787181fda437b9b0 (patch) | |
| tree | b1c044c9e5d141a27b45f05168ac03cb1d4868ee /addons/web/static/src/js | |
| parent | 79f7eaf08ce74897a13d7878d442339e976c3e7d (diff) | |
Solved warning problem
bzr revid: nicolas.vanhoren@openerp.com-20130130152552-l07fk2lahfnb9ckx
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 22 | ||||
| -rw-r--r-- | addons/web/static/src/js/test_support.js | 2 |
2 files changed, 10 insertions, 14 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index f2de7e61eab..bdc1dd4c02c 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -247,19 +247,12 @@ instance.web.CrashManager = instance.web.Class.extend({ if (!this.active) { return; } - // yes, exception handling is shitty - if (error.code === 300 && error.data && error.data.type == "client_exception" && error.data.debug.match("SessionExpiredException")) { - this.show_warning({type: "Session Expired", data: { fault_code: "Your OpenERP session expired. Please refresh the current web page." }}); + if (error.data.name === "openerp.addons.web.session SessionExpiredException") { + this.show_warning({type: "Session Expired", data: { message: "Your OpenERP session expired. Please refresh the current web page." }}); return; } - if (error.data.fault_code) { - var split = ("" + error.data.fault_code).split('\n')[0].split(' -- '); - if (split.length > 1) { - error.type = split.shift(); - error.data.fault_code = error.data.fault_code.substr(error.type.length + 4); - } - } - if (error.code === 200 && error.type) { + if (error.data.exception_type === "except_osv" || error.data.exception_type === "warning" + || error.data.exception_type === "access_error") { this.show_warning(error); } else { this.show_error(error); @@ -269,8 +262,11 @@ instance.web.CrashManager = instance.web.Class.extend({ if (!this.active) { return; } + if (error.data.exception_type === "except_osv") { + error = _.extend({}, error, {data: _.extend({}, error.data, {message: error.data.arguments[0] + "\n\n" + error.data.arguments[1]})}); + } instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), { - title: "OpenERP " + _.str.capitalize(error.type), + title: "OpenERP " + (_.str.capitalize(error.type) || "Warning"), buttons: [ {text: _t("Ok"), click: function() { $(this).dialog("close"); }} ] @@ -650,7 +646,7 @@ instance.web.Login = instance.web.Widget.extend({ } }, on_db_failed: function (error, event) { - if (error.data.fault_code === 'AccessDenied') { + if (error.data.name === 'openerp.exceptions.AccessDenied') { event.preventDefault(); } }, diff --git a/addons/web/static/src/js/test_support.js b/addons/web/static/src/js/test_support.js index 90173f89845..82c1d6fa26e 100644 --- a/addons/web/static/src/js/test_support.js +++ b/addons/web/static/src/js/test_support.js @@ -72,7 +72,7 @@ openerp.test_support = { } return; } - fn(e.data.fault_code); + fn(e.data.name); }) } }; |
