Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/830617 )
Change subject: [IMPR] catch ServerError as a whole in reflinks.py ......................................................................
[IMPR] catch ServerError as a whole in reflinks.py
All server errors derive from ServerError which can be used to catch them all. https://doc.wikimedia.org/pywikibot/master/api_ref/exceptions.html?highlight...
Change-Id: Id355cc666813b090924060815507a896684f6821 --- M scripts/reflinks.py 1 file changed, 2 insertions(+), 8 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 51c0951..7cfba8e 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -64,11 +64,7 @@ from pywikibot.backports import removeprefix from pywikibot.bot import ConfigParserBot, ExistingPageBot, SingleSiteBot from pywikibot.comms.http import get_charset_from_content_type -from pywikibot.exceptions import ( - FatalServerError, - Server414Error, - Server504Error, -) +from pywikibot.exceptions import ServerError from pywikibot.pagegenerators import ( XMLDumpPageGenerator as _XMLDumpPageGenerator, ) @@ -638,9 +634,7 @@ except (ValueError, # urllib3.LocationParseError derives from it OSError, httplib.error, - FatalServerError, - Server414Error, - Server504Error) as e: + ServerError) as e: pywikibot.output( "{err.__class__.__name__}: Can't retrieve url {url}: {err}" .format(url=ref.url, err=e))