comparison mercurial/revlog.py @ 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 cafd8a8fb713
children d628bcb3a567
comparison
equal deleted inserted replaced
16843:61f3ca8e4d39 16883:5e3a1b96dbb0
110 return bin 110 return bin
111 t = bin[0] 111 t = bin[0]
112 if t == '\0': 112 if t == '\0':
113 return bin 113 return bin
114 if t == 'x': 114 if t == 'x':
115 return _decompress(bin) 115 try:
116 return _decompress(bin)
117 except zlib.error, e:
118 raise RevlogError(_("revlog decompress error: %s") % str(e))
116 if t == 'u': 119 if t == 'u':
117 return bin[1:] 120 return bin[1:]
118 raise RevlogError(_("unknown compression type %r") % t) 121 raise RevlogError(_("unknown compression type %r") % t)
119 122
120 indexformatv0 = ">4l20s20s20s" 123 indexformatv0 = ">4l20s20s20s"