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=fatalservererror#exceptions.FatalServerError

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

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/830617
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id355cc666813b090924060815507a896684f6821
Gerrit-Change-Number: 830617
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to