changeset 16883:5e3a1b96dbb0

revlog: zlib.error sent to the user (issue3424) Give the user the zlib error message instead of a backtrace when decompression fails.
author Brad Hall <bhall@fb.com>
date Mon, 04 Jun 2012 14:46:42 -0700
parents 61f3ca8e4d39
children d628bcb3a567
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Jun 03 19:35:45 2012 +0200
+++ b/mercurial/revlog.py	Mon Jun 04 14:46:42 2012 -0700
@@ -112,7 +112,10 @@
     if t == '\0':
         return bin
     if t == 'x':
-        return _decompress(bin)
+        try:
+            return _decompress(bin)
+        except zlib.error, e:
+            raise RevlogError(_("revlog decompress error: %s") % str(e))
     if t == 'u':
         return bin[1:]
     raise RevlogError(_("unknown compression type %r") % t)