From 9882c8826edcf2f36608a18fc7c85f89da856837 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 14 Sep 2015 10:10:11 +0200 Subject: [PATCH] [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. --- addons/web/static/src/js/framework/widget.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/static/src/js/framework/widget.js b/addons/web/static/src/js/framework/widget.js index 3a90e432000..a6b189dc832 100644 --- a/addons/web/static/src/js/framework/widget.js +++ b/addons/web/static/src/js/framework/widget.js @@ -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); }; },