mirror of
https://github.com/9001/copyparty.git
synced 2025-09-30 13:42:27 -06:00
MTHash: fully preserve exception info
This commit is contained in:
parent
ec7418734d
commit
eb5d767b01
|
@ -1197,21 +1197,21 @@ class MTHash(object):
|
||||||
for nch in range(nchunks):
|
for nch in range(nchunks):
|
||||||
self.work_q.put(nch)
|
self.work_q.put(nch)
|
||||||
|
|
||||||
ex = ""
|
ex: Optional[Exception] = None
|
||||||
for nch in range(nchunks):
|
for nch in range(nchunks):
|
||||||
qe = self.done_q.get()
|
qe = self.done_q.get()
|
||||||
try:
|
try:
|
||||||
nch, dig, ofs, csz = qe
|
nch, dig, ofs, csz = qe
|
||||||
chunks[nch] = (dig, ofs, csz)
|
chunks[nch] = (dig, ofs, csz)
|
||||||
except:
|
except:
|
||||||
ex = ex or str(qe)
|
ex = ex or qe # type: ignore
|
||||||
|
|
||||||
if pp:
|
if pp:
|
||||||
mb = (fsz - nch * chunksz) // (1024 * 1024)
|
mb = (fsz - nch * chunksz) // (1024 * 1024)
|
||||||
pp.msg = prefix + str(mb) + suffix
|
pp.msg = prefix + str(mb) + suffix
|
||||||
|
|
||||||
if ex:
|
if ex:
|
||||||
raise Exception(ex)
|
raise ex
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
for n in range(nchunks):
|
for n in range(nchunks):
|
||||||
|
@ -1228,7 +1228,7 @@ class MTHash(object):
|
||||||
try:
|
try:
|
||||||
v = self.hash_at(ofs)
|
v = self.hash_at(ofs)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
v = str(ex) # type: ignore
|
v = ex # type: ignore
|
||||||
|
|
||||||
self.done_q.put(v)
|
self.done_q.put(v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue