forked from LBRYCommunity/lbry-sdk
change some ValueErrors to IOErrors
This commit is contained in:
parent
421141b958
commit
8419e1e1d5
3 changed files with 5 additions and 6 deletions
|
@ -161,7 +161,7 @@ class BlobFile(object):
|
|||
d = file_sender.beginFileTransfer(file_handle, reader)
|
||||
d.addCallback(close_self)
|
||||
else:
|
||||
d = defer.fail(ValueError("Could not read the blob"))
|
||||
d = defer.fail(IOError("Could not read the blob"))
|
||||
return d
|
||||
|
||||
def writer_finished(self, writer, err=None):
|
||||
|
|
|
@ -22,9 +22,8 @@ class HashBlobWriter(object):
|
|||
|
||||
def write(self, data):
|
||||
if self.write_handle is None:
|
||||
log.info("writer has already been closed")
|
||||
# can this be changed to IOError?
|
||||
raise ValueError('I/O operation on closed file')
|
||||
log.exception("writer has already been closed")
|
||||
raise IOError('I/O operation on closed file')
|
||||
|
||||
self._hashsum.update(data)
|
||||
self.len_so_far += len(data)
|
||||
|
|
|
@ -90,8 +90,8 @@ class BlobFileTest(unittest.TestCase):
|
|||
writer.close()
|
||||
yield self.assertFailure(finished_d, DownloadCanceledError)
|
||||
|
||||
# writes after close will throw a ValueError exception
|
||||
with self.assertRaises(ValueError):
|
||||
# writes after close will throw a IOError exception
|
||||
with self.assertRaises(IOError):
|
||||
writer.write(self.fake_content)
|
||||
|
||||
# another call to close will do nothing
|
||||
|
|
Loading…
Add table
Reference in a new issue