[open-ils-commits] r15688 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 3 18:00:30 EST 2010


Author: erickson
Date: 2010-03-03 18:00:23 -0500 (Wed, 03 Mar 2010)
New Revision: 15688

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Log:
wrap labelFormat formatting in try/catch to present better errors to caller

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js	2010-03-03 21:31:19 UTC (rev 15687)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js	2010-03-03 23:00:23 UTC (rev 15688)
@@ -395,12 +395,19 @@
                             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);
+                                }
                             }
                         );
                     }



More information about the open-ils-commits mailing list