hgext/highlight.py
changeset 6511 5c1bb5750558
parent 6485 938319418d8c
parent 6494 c30849d4c8ba
child 6664 1e3c1f010808
--- a/hgext/highlight.py	Thu Apr 10 14:08:38 2008 +0200
+++ b/hgext/highlight.py	Thu Apr 10 14:25:50 2008 +0200
@@ -51,10 +51,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)