jenkins-bot merged this change.
[IMPR] Check for request.status first
First check for request.status and raise the related exception.
Finally raise the exception from request layer
Bug: T253236
Change-Id: I7edc0dab6de2ad4254494161ffdecc139606002a
---
M pywikibot/comms/http.py
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 2051afd..fd32330 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -398,17 +398,16 @@
if SSL_CERT_VERIFY_FAILED_MSG in str(request.data):
raise FatalServerError(str(request.data))
- # if all else fails
- if isinstance(request.data, Exception):
- error('An error occurred for uri ' + request.uri)
- raise request.data
-
if request.status == 504:
raise Server504Error('Server %s timed out' % request.hostname)
if request.status == 414:
raise Server414Error('Too long GET request')
+ if isinstance(request.data, Exception):
+ error('An error occurred for uri ' + request.uri)
+ raise request.data
+
# HTTP status 207 is also a success status for Webdav FINDPROP,
# used by the version module.
if request.status not in (200, 207):
To view, visit change 598510. To unsubscribe, or for help writing mail filters, visit settings.