jenkins-bot has submitted this change and it was merged. Change subject: Report malformed URLs ......................................................................
Report malformed URLs Don't throw URL exception in the checker thread if the URL cannot be parsed. Introduce NotAnURLError exception to allow information about malformed URLs to be passed to the reporting facility. Change-Id: I93d45db6dec10210ff760154111853f53a042755 --- M weblinkchecker.py 1 file changed, 11 insertions(+), 0 deletions(-) Approvals: John Vandenberg: Looks good to me, approved saper: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/weblinkchecker.py b/weblinkchecker.py index e7f2a90..8b54517 100644 --- a/weblinkchecker.py +++ b/weblinkchecker.py @@ -218,6 +218,10 @@ pass +class NotAnURLError(BaseException): + pass + + class LinkChecker(object): """ Given a HTTP URL, tries to load the page from the Internet and checks if it @@ -259,6 +263,8 @@ return httplib.HTTPConnection(self.host) elif self.scheme == 'https': return httplib.HTTPSConnection(self.host) + else: + raise NotAnURLError(self.url) def getEncodingUsedByServer(self): if not self.serverEncoding: @@ -489,6 +495,11 @@ linkChecker = LinkChecker(self.url, HTTPignore=self.HTTPignore) try: ok, message = linkChecker.check() + except NotAnURLError as e: + ok, message = False, i18n.twtranslate(pywikibot.getSite(), + 'weblinkchecker-badurl_msg', + {'URL': self.url}) + except: pywikibot.output('Exception while processing URL %s in page %s' % (self.url, self.page.title())) -- To view, visit https://gerrit.wikimedia.org/r/175638 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I93d45db6dec10210ff760154111853f53a042755 Gerrit-PatchSet: 3 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: saper <sa...@saper.info> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: jenkins-bot <> Gerrit-Reviewer: saper <sa...@saper.info> _______________________________________________ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits