From 3d119b9a45d865efe818b37c2e18d34f7e1cf435 Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 29 Jan 2002 21:20:37 +0000 Subject: [PATCH] internal_error message git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@360 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- debian/changelog | 7 +++++++ linkcheck/HttpsUrlData.py | 4 ++-- linkcheck/IgnoredUrlData.py | 2 +- linkcheck/UrlData.py | 37 +++++++++++++++++++++++++++++++++++++ linkcheck/__init__.py | 2 ++ setup.py | 2 +- 6 files changed, 50 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1a50aaf3..65657407 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +linkchecker (1.3.18) unstable; urgency=low + + * linkcheck/HttpUrlData.py: cope with malformed http_proxy settings + * linkcheck/UrlData.py: print a nice error message for internal errors + + -- Bastian Kleineidam Tue, 29 Jan 2002 21:57:03 +0100 + linkchecker (1.3.17) unstable; urgency=low * linkcheck/TelnetUrlData.py: fix telnet syntax checking diff --git a/linkcheck/HttpsUrlData.py b/linkcheck/HttpsUrlData.py index e0525f1c..ae69cc82 100644 --- a/linkcheck/HttpsUrlData.py +++ b/linkcheck/HttpsUrlData.py @@ -32,9 +32,9 @@ class HttpsUrlData(HttpUrlData): return h - def check(self, config): + def _check(self, config): if _supportHttps: - HttpUrlData.check(self, config) + HttpUrlData._check(self, config) else: self.setWarning(_("HTTPS url ignored")) self.logMe(config) diff --git a/linkcheck/IgnoredUrlData.py b/linkcheck/IgnoredUrlData.py index f8be04c3..19e178b4 100644 --- a/linkcheck/IgnoredUrlData.py +++ b/linkcheck/IgnoredUrlData.py @@ -56,6 +56,6 @@ acap # application configuration access protocol class IgnoredUrlData(UrlData): """Some schemes are defined in http://www.w3.org/Addressing/schemes""" - def check(self, config): + def _check(self, config): self.setWarning(_("%s url ignored")%self.scheme.capitalize()) self.logMe(config) diff --git a/linkcheck/UrlData.py b/linkcheck/UrlData.py index 185410f0..f6381823 100644 --- a/linkcheck/UrlData.py +++ b/linkcheck/UrlData.py @@ -21,6 +21,35 @@ debug = Config.debug from linkcheck import _ from debuglevels import * +# helper function for internal errors +def internal_error (): + print >> sys.stderr, _("""\n********** Oops, I did it again. ************* + +You have found an internal error in LinkChecker. +Please write a bug report to %s and include +the following information. +If you disclose some information because its too private to you thats ok. +I will try to help you nontheless (but you have to give me *something* +I can work with ;). +""") % Config.Email + import traceback + traceback.print_exc() + print_app_info() + print >> sys.stderr, _("\n******** LinkChecker internal error, bailing out ********") + sys.exit(1) + + +def print_app_info (): + import os + print >> sys.stderr, _("System info:") + print >> sys.stderr, Config.App + print >> sys.stderr, "Python %s on %s" % (sys.version, sys.platform) + for key in ("LC_ALL", "LC_MESSAGES", "http_proxy", "ftp_proxy"): + value = os.getenv(key) + if value is not None: + print >> sys.stderr, key, "=", `value` + + # we catch these exceptions, all other exceptions are internal # or system errors ExcList = [ @@ -207,6 +236,14 @@ class UrlData: def check(self, config): + try: + self._check(config) + except KeyboardInterrupt: + pass + except: + internal_error() + + def _check(self, config): debug(BRING_IT_ON, "Checking", self) if self.recursionLevel and config['wait']: debug(BRING_IT_ON, "sleeping for", config['wait'], "seconds") diff --git a/linkcheck/__init__.py b/linkcheck/__init__.py index 80b50cd8..865138d3 100644 --- a/linkcheck/__init__.py +++ b/linkcheck/__init__.py @@ -36,6 +36,8 @@ import Config, UrlData, sys, lc_cgi from debuglevels import * debug = Config.debug + +# main check function def checkUrls(config): """ checkUrls gets a complete configuration object as parameter where all runtime-dependent options are stored. diff --git a/setup.py b/setup.py index 9af49237..cd70aac2 100755 --- a/setup.py +++ b/setup.py @@ -129,7 +129,7 @@ myname = "Bastian Kleineidam" myemail = "calvin@users.sourceforge.net" setup (name = "linkchecker", - version = "1.3.17", + version = "1.3.18", description = "check HTML documents for broken links", author = myname, author_email = myemail,