[IMP] web: improve Widget.proxy's error reporting

Provide a more informative error message than "undefined is not a
function" when a method passed by name to the events object is missing
on the widget.
This commit is contained in:
Xavier Morel
2015-09-14 10:20:30 +02:00
parent 330bf5ec2f
commit 9882c8826e
@@ -392,6 +392,9 @@ var Widget = core.Class.extend(mixins.PropertiesMixin, {
var self = this;
return function () {
var fn = (typeof method === 'string') ? self[method] : method;
if (fn === void 0) {
throw new Error("Couldn't find method '" + method + "' in widget " + self);
}
return fn.apply(self, arguments);
};
},