From 9f97979b98845a72899fd24166f7546d48302f52 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 3 Mar 2010 23:00:23 +0000 Subject: [PATCH] wrap labelFormat formatting in try/catch to present better errors to caller git-svn-id: svn://svn.open-ils.org/ILS/trunk@15688 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 49ccf7c235..3e5dd90461 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -395,12 +395,19 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { function(item) { var values = []; - // self.labelFormat[1..*] are names of fields. Pull the field - // values from each object to determine the values for string substitution - for(var i = 1; i< self.labelFormat.length; i++) - values.push(item[self.labelFormat[i]]); + try { - item._label = dojo.string.substitute(format, values); + // self.labelFormat[1..*] are names of fields. Pull the field + // values from each object to determine the values for string substitution + for(var i = 1; i< self.labelFormat.length; i++) + values.push(item[self.labelFormat[i]]); + + item._label = dojo.string.substitute(format, values); + + } catch(E) { + throw new Error("openils.widget.AutoFieldWidget: Invalid labelFormat [" + + self.labelFormat + "] : " + E); + } } ); } -- 2.11.0