jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/791771 )
Change subject: [IMPR] raise InvalidTitleError instead of ValueError in ProofreadPage ......................................................................
[IMPR] raise InvalidTitleError instead of ValueError in ProofreadPage
If the ProofreadPage title has a wrong index raise InvalidTitleError instead of unspecific ValueError('ValueError: invalid literal for int() with base 10: {!r}')
Bug: T308016 Change-Id: I39c6569fb15a6864fe2f51e303741739420f4127 --- M pywikibot/proofreadpage.py 1 file changed, 6 insertions(+), 2 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py index 8378c4f..19fc121 100644 --- a/pywikibot/proofreadpage.py +++ b/pywikibot/proofreadpage.py @@ -48,7 +48,7 @@ ) from pywikibot.comms import http from pywikibot.data.api import ListGenerator, Request -from pywikibot.exceptions import Error, OtherPageSaveError +from pywikibot.exceptions import Error, InvalidTitleError, OtherPageSaveError from pywikibot.page import PageSourceType from pywikibot.tools import cached
@@ -247,7 +247,11 @@
if sep: base = left - num = int(right) + try: + num = int(right) + except ValueError: + raise InvalidTitleError('{} containts invalid index {!r}' + .format(self, right)) else: base = right