hgext/highlight.py
changeset 6494 c30849d4c8ba
parent 6212 e75aab656f46
child 6511 5c1bb5750558
child 6662 22c303a514f8
--- a/hgext/highlight.py	Tue Apr 08 18:39:02 2008 +0200
+++ b/hgext/highlight.py	Thu Apr 10 14:24:27 2008 +0200
@@ -59,10 +59,10 @@
     try:
         lexer = guess_lexer_for_filename(fctx.path(), text,
                                          encoding=util._encoding)
-    except ClassNotFound:
+    except (ClassNotFound, ValueError):
         try:
             lexer = guess_lexer(text, encoding=util._encoding)
-        except ClassNotFound:
+        except (ClassNotFound, ValueError):
             lexer = TextLexer(encoding=util._encoding)
 
     formatter = HtmlFormatter(style=style, encoding=util._encoding)