From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 3 Mar 2010 23:00:23 +0000 (+0000) Subject: wrap labelFormat formatting in try/catch to present better errors to caller X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9f97979b98845a72899fd24166f7546d48302f52;p=evergreen%2Fpines.git 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 --- 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); + } } ); }