jenkins-bot submitted this change.

View Change

Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
[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(-)

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


To view, visit change 791771. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I39c6569fb15a6864fe2f51e303741739420f4127
Gerrit-Change-Number: 791771
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged