mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-25 03:35:28 +00:00
Correctly reraise exception
This commit is contained in:
parent
85a4d78213
commit
e21370ba54
@ -24,6 +24,7 @@ import contextlib
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -114,12 +115,13 @@ class MediaStorage(object):
|
|||||||
try:
|
try:
|
||||||
with open(fname, "wb") as f:
|
with open(fname, "wb") as f:
|
||||||
yield f, fname, finish
|
yield f, fname, finish
|
||||||
except Exception as e:
|
except Exception:
|
||||||
|
t, v, tb = sys.exc_info()
|
||||||
try:
|
try:
|
||||||
os.remove(fname)
|
os.remove(fname)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
raise e
|
raise t, v, tb
|
||||||
|
|
||||||
if not finished_called:
|
if not finished_called:
|
||||||
raise Exception("Finished callback not called")
|
raise Exception("Finished callback not called")
|
||||||
|
Loading…
Reference in New Issue
Block a user