Xqt submitted this change.

View Change

Approvals: Xqt: Verified; Looks good to me, approved
[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=fatalservererror#exceptions.FatalServerError

Change-Id: Id355cc666813b090924060815507a896684f6821
---
M scripts/reflinks.py
1 file changed, 2 insertions(+), 8 deletions(-)

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))

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id355cc666813b090924060815507a896684f6821
Gerrit-Change-Number: 830617
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged