raise instead of assert
This commit is contained in:
parent
96357ab833
commit
421141b958
1 changed files with 2 additions and 1 deletions
|
@ -51,7 +51,8 @@ class DiskBlobManager(DHTHashSupplier):
|
||||||
"""Return a blob identified by blob_hash, which may be a new blob or a
|
"""Return a blob identified by blob_hash, which may be a new blob or a
|
||||||
blob that is already on the hard disk
|
blob that is already on the hard disk
|
||||||
"""
|
"""
|
||||||
assert length is None or isinstance(length, int)
|
if length is not None and not isinstance(length, int):
|
||||||
|
raise Exception("invalid length type: %s (%s)", length, str(type(length)))
|
||||||
if blob_hash in self.blobs:
|
if blob_hash in self.blobs:
|
||||||
return defer.succeed(self.blobs[blob_hash])
|
return defer.succeed(self.blobs[blob_hash])
|
||||||
return self._make_new_blob(blob_hash, length)
|
return self._make_new_blob(blob_hash, length)
|
||||||
|
|
Loading…
Reference in a new issue