From a87b8a64d29f649768633a415c8a6a51ca4c035c Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 9 Nov 2004 12:39:53 +0000 Subject: [PATCH] do not catch exceptions git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1936 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/ansicolor.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/linkcheck/ansicolor.py b/linkcheck/ansicolor.py index 3aa8bb65..d03c379b 100644 --- a/linkcheck/ansicolor.py +++ b/linkcheck/ansicolor.py @@ -213,22 +213,17 @@ class ColoredStreamHandler (logging.StreamHandler, object): If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline - [N.B. this may be removed depending on feedback]. If exception - information is present, it is formatted using - traceback.print_exception and appended to the stream. + [N.B. this may be removed depending on feedback]. """ color = self.get_color(record) - try: - msg = self.format(record) - if not hasattr(types, "UnicodeType"): #if no unicode support... + msg = self.format(record) + if not hasattr(types, "UnicodeType"): #if no unicode support... + self.stream.write("%s" % msg, color=color) + else: + try: self.stream.write("%s" % msg, color=color) - else: - try: - self.stream.write("%s" % msg, color=color) - except UnicodeError: - self.stream.write("%s" % msg.encode("UTF-8"), - color=color) - self.stream.write(os.linesep) - self.flush() - except: - self.handleError(record) + except UnicodeError: + self.stream.write("%s" % msg.encode("UTF-8"), + color=color) + self.stream.write(os.linesep) + self.flush()