summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-10-09 11:30:35 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-10-09 11:30:35 +0200
commitdfad511a559e851a8471e93cecc998131ee143f4 (patch)
treead7e0d4bd0b4685cb9fa85bc76f1c1da9687022f /addons/web/static/src
parent2f6ad073ba6f100c2699fdae42449178f876a061 (diff)
[IMP] put better error message when widget options are not valid JSON
bzr revid: nicolas.vanhoren@openerp.com-20121009093035-1y3fxr95qo2thryq
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 0044a89fa3a..8e7364ee50a 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2068,7 +2068,11 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
this.field = this.field_manager.get_field_desc(this.name);
this.widget = this.node.attrs.widget;
this.string = this.node.attrs.string || this.field.string || this.name;
- this.options = JSON.parse(this.node.attrs.options || '{}');
+ try {
+ this.options = JSON.parse(this.node.attrs.options || '{}');
+ } catch (e) {
+ throw new Error(_.str.sprintf(_t("Widget options for field '%s' are not valid JSON."), this.name));
+ }
this.set({'value': false});
this.on("change:value", this, function() {