]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
encode.py: improve error message when segment lengths come out wrong
authorBrian Warner <warner@allmydata.com>
Fri, 25 Jan 2008 04:51:09 +0000 (21:51 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 25 Jan 2008 04:51:09 +0000 (21:51 -0700)
src/allmydata/encode.py

index 1615b00f9fccea943a735347906cbab9c6e80bd3..0815df937bba290dc2c49fdc76c3d4b8d729dd1f 100644 (file)
@@ -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]