Bug 414141 - Help debug bad plural strings to PluralForm.jsm by printing the caller. r=l10n@mozilla.com, r=smontagu, a1.9=schrep
authoredward.lee@engineering.uiuc.edu
Sun, 27 Jan 2008 09:44:08 -0800
changeset 10788 c094dd7a68395d22ef0ab268f35c654a542c84ab
parent 10787 c0d7936984d9df53186b36afcb67ec3ae785fcbf
child 10789 b9b8c45017a818f275b26e1fc3a3d730392047d4
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersl10n, smontagu
bugs414141
milestone1.9b3pre
Bug 414141 - Help debug bad plural strings to PluralForm.jsm by printing the caller. r=l10n@mozilla.com, r=smontagu, a1.9=schrep
intl/locale/src/PluralForm.jsm
--- a/intl/locale/src/PluralForm.jsm
+++ b/intl/locale/src/PluralForm.jsm
@@ -133,19 +133,22 @@ let PluralForm = {
       let index = pluralFunc(aNum ? Number(aNum) : 0);
       let words = aWords ? aWords.split(/;/) : [""];
 
       // Explicitly check bounds to avoid strict warnings
       let ret = index < words.length ? words[index] : undefined;
 
       // Check for array out of bounds or empty strings
       if ((ret == undefined) || (ret == "")) {
+        // Report the caller to help figure out who is causing badness
+        let caller = this.get.caller ? this.get.caller.name : "top";
+
         // Display a message in the error console
         log(["Index #", index, " of '", aWords, "' for value ", aNum,
-            " is invalid -- plural rule #", ruleNum]);
+            " is invalid -- plural rule #", ruleNum, "; called by ", caller]);
 
         // Default to the first entry (which might be empty, but not undefined)
         ret = words[0];
       }
 
       return ret;
     };
   })(),