jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/485054 )

Change subject: [IMPR] Provide a better error messages
......................................................................

[IMPR] Provide a better error messages

Bug: T213855
Change-Id: I5bb9e9a1722b00ba8ea6391229dfaab6f405dbe9
---
M pywikibot/i18n.py
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Dvorapa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index d6ca56e..84ebdc0 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -490,14 +490,15 @@
             return specific_entries[num]

         index = plural_value(num)
-        if rule['nplurals'] == 1:
+        needed = rule['nplurals']
+        if needed == 1:
             assert index == 0

         if index >= len(plural_entries):
             raise IndexError(
-                'requested plural {0} for {1} but only {2} ("{3}") '
-                'provided'.format(
-                    index, selector, len(plural_entries),
+                'language "{}" requires {} plural variants for "{}" but '
+                'only {} ("{}") provided'.format(
+                    code, needed, selector, len(plural_entries),
                     '", "'.join(plural_entries)))
         return plural_entries[index]


--
To view, visit https://gerrit.wikimedia.org/r/485054
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5bb9e9a1722b00ba8ea6391229dfaab6f405dbe9
Gerrit-Change-Number: 485054
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dvorapa <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to