Meno25 submitted this change.
[IMPR] Skip PageSaveRelatedError and ServerError in checkimages
- skip PageSaveRelatedError when putting talk page
if CheckImagesBot.ignore_save_related_errors is True (default: True)
- skip ServerError when putting talk page
if CheckImagesBot.ignore_server_errors is True (default: False)
Bug: T302174
Change-Id: I5b72e844218e9386a3387c4f9f091df6d2a26482
---
M scripts/checkimages.py
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index b1f88b2..fb911dd 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -99,6 +99,8 @@
NoPageError,
NotEmailableError,
PageRelatedError,
+ PageSaveRelatedError,
+ ServerError,
TranslationError,
)
from pywikibot.family import Family
@@ -501,6 +503,9 @@
"""A robot to check recently uploaded files."""
+ ignore_save_related_errors = True
+ ignore_server_errors = False
+
def __init__(self, site, log_full_number=25000, sendemail_active=False,
duplicates_report=False, log_full_error=True,
max_user_notify=None) -> None:
@@ -726,11 +731,22 @@
try:
self.talk_page.put(new_text, summary=commentox, minor=False)
- except LockedPageError:
- pywikibot.output('Talk page blocked, skip.')
+ except PageSaveRelatedError as e:
+ if not self.ignore_save_related_errors:
+ raise
+ err = e
+ except ServerError as e:
+ if not self.ignore_server_errors:
+ raise
+ err = e
else:
if self.num_notify is not None:
self.num_notify[self.talk_page.title()] -= 1
+ err = None
+ if err:
+ pywikibot.exception(err)
+ pywikibot.output('Skipping saving talk page {}'
+ .format(self.talk_page))
if email_page_name and email_subj:
email_page = pywikibot.Page(self.site, email_page_name)
To view, visit change 765471. To unsubscribe, or for help writing mail filters, visit settings.