From: Brian Warner Date: Fri, 25 Jan 2008 04:51:09 +0000 (-0700) Subject: encode.py: improve error message when segment lengths come out wrong X-Git-Tag: allmydata-tahoe-0.8.0~230 X-Git-Url: https://git.rkrishnan.org/install.html?a=commitdiff_plain;h=081d27a65d02e82578799c7d2e2979d4a0e02afc;p=tahoe-lafs%2Ftahoe-lafs.git encode.py: improve error message when segment lengths come out wrong --- diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py index 1615b00f..0815df93 100644 --- a/src/allmydata/encode.py +++ b/src/allmydata/encode.py @@ -352,7 +352,11 @@ class Encoder(object): encrypted_pieces.append('\x00' * pad_size) else: # non-tail segments should be the full segment size - assert length == input_chunk_size + log.msg("non-tail segment should be full segment size: %d!=%d" + % (length, input_chunk_size), level=log.BAD) + precondition(length == input_chunk_size, + "length=%d != input_chunk_size=%d" % + (length, input_chunk_size)) encrypted_piece = "".join(encrypted_pieces) return previous_chunks + [encrypted_piece]