jenkins-bot has submitted this change and it was merged.
Change subject: Raise urllib exception when network error raised. ......................................................................
Raise urllib exception when network error raised.
If there are network problems, the exception should not be caught and hidden behind a new ParseError without a useful backtrace.
Bug: 66063 Change-Id: I6c2d19a94bcf997f51364efce804ec494274043e --- M pywikibot/version.py 1 file changed, 9 insertions(+), 5 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/version.py b/pywikibot/version.py index 608d7e1..26bc0dc 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -21,7 +21,7 @@
class ParseError(Exception):
- """ Parsing went wrong """ + """ Parsing went wrong. """
def _get_program_dir(): @@ -182,14 +182,18 @@
def getversion_onlinerepo(repo=None): - """ Retrieve revision number of framework online repository's svnroot """ + """Retrieve current framework revision number from online repository. + + @param repo: (optional) Online repository location + @type repo: URL or string + """ url = repo or 'https://git.wikimedia.org/feed/pywikibot/core' hsh = None + buf = urllib.urlopen(url).readlines() try: - buf = urllib.urlopen(url).readlines() hsh = buf[13].split('/')[5][:-1] - except: - raise ParseError + except Exception as e: + raise ParseError(repr(e) + ' while parsing ' + repr(buf)) return hsh
pywikibot-commits@lists.wikimedia.org