[IMP] Raise console.error when no action.type defined

I see this error from times to times but never had a chance to reproduce it.
console.error will give a traceback + action object in order to fix the issue

bzr revid: fme@openerp.com-20111207161353-vnp6dm21xyedxgeg
This commit is contained in:
Fabien Meghazi 2011-12-07 17:13:53 +01:00
parent 0ae257c780
commit e9a54a5c11
1 changed files with 5 additions and 1 deletions

View File

@ -75,6 +75,10 @@ session.web.ActionManager = session.web.Widget.extend({
}
},
do_action: function(action, on_close) {
if (!action.type) {
console.error("No type for action", action);
return;
}
var type = action.type.replace(/\./g,'_');
var popup = action.target === 'new';
action.flags = _.extend({
@ -85,7 +89,7 @@ session.web.ActionManager = session.web.Widget.extend({
pager : !popup
}, action.flags || {});
if (!(type in this)) {
console.log("Action manager can't handle action of type " + action.type, action);
console.error("Action manager can't handle action of type " + action.type, action);
return;
}
return this[type](action, on_close);