jenkins-bot has submitted this change and it was merged.
Change subject: revertbot uses invalid pywikibot.out ......................................................................
revertbot uses invalid pywikibot.out
Also performs equality between APIError and string, which is brittle. And silently ignored all other types of APIError.
Change-Id: Idf056b7845c348101bd0033d1f625dff629da49d --- M scripts/revertbot.py 1 file changed, 5 insertions(+), 3 deletions(-)
Approvals: Ricordisamoa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/revertbot.py b/scripts/revertbot.py index 9a2741f..161263e 100644 --- a/scripts/revertbot.py +++ b/scripts/revertbot.py @@ -112,9 +112,11 @@ pywikibot.data.api.Request(action="rollback", title=page.title(), user=self.user, token=rev[4], markbot=1).submit() except pywikibot.data.api.APIError as e: - if e == "badtoken: Invalid token": - pywikibot.out("There is an issue for rollbacking the edit, Giving up") - return False + if e.code == 'badtoken': + pywikibot.error("There was an API token error rollbacking the edit") + else: + pywikibot.exception() + return False return u"The edit(s) made in %s by %s was rollbacked" % (page.title(), self.user)
def log(self, msg):