summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-02-06 17:23:47 +0100
committerXavier Morel <xmo@openerp.com>2012-02-06 17:23:47 +0100
commitb7e761fca8ab1c06d0d422527f5eee003ed323a7 (patch)
treed11b8abb2b5a5ad6e111f73c9223db9c1ae679bf /addons/web/static/src
parent71ba9429d7617378cb9d6bb976844982247dd927 (diff)
[FIX] forward uncaught errors to global crash manager
bzr revid: xmo@openerp.com-20120206162347-1hr30acmy7l3mh78
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 377a5ed5ea2..86280f1cf30 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -141,12 +141,7 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog#
});
openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
- init: function() {
- this._super();
- openerp.connection.on_rpc_error.add(this.on_rpc_error);
- },
on_rpc_error: function(error) {
- this.error = error;
if (error.data.fault_code) {
var split = ("" + error.data.fault_code).split('\n')[0].split(' -- ');
if (split.length > 1) {
@@ -195,7 +190,7 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
};
}
var dialog = new openerp.web.Dialog(this, {
- title: "OpenERP " + _.str.capitalize(this.error.type),
+ title: "OpenERP " + _.str.capitalize(error.type),
width: '80%',
height: '50%',
min_width: '800px',
@@ -1112,8 +1107,17 @@ openerp.web.WebClient = openerp.web.OldWidget.extend(/** @lends openerp.web.WebC
self.menu.start();
},
show_common: function() {
+ var self = this;
if (!this.crashmanager) {
this.crashmanager = new openerp.web.CrashManager();
+ openerp.connection.on_rpc_error.add(this.crashmanager.on_rpc_error);
+ window.onerror = function (message, file, line) {
+ self.crashmanager.on_traceback({
+ type: _t("Client Error"),
+ message: message,
+ data: {debug: file + ':' + line}
+ });
+ }
}
this.notification = new openerp.web.Notification(this);
this.notification.appendTo(this.$element);