mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
Fix stacktrace mangling in patch_inline_callbacks
(#7554)
`Failure()` is more cunning than `Failure(e)`.
This commit is contained in:
parent
d84bdfe599
commit
a0f99f81b3
2 changed files with 8 additions and 2 deletions
1
changelog.d/7554.misc
Normal file
1
changelog.d/7554.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Fix some test code to not mangle stacktraces, to make it easier to debug errors.
|
|
@ -186,10 +186,15 @@ def _check_yield_points(f: Callable, changes: List[str]):
|
|||
)
|
||||
raise Exception(err)
|
||||
|
||||
# the wrapped function yielded a Deferred: yield it back up to the parent
|
||||
# inlineCallbacks().
|
||||
try:
|
||||
result = yield d
|
||||
except Exception as e:
|
||||
result = Failure(e)
|
||||
except Exception:
|
||||
# this will fish an earlier Failure out of the stack where possible, and
|
||||
# thus is preferable to passing in an exeception to the Failure
|
||||
# constructor, since it results in less stack-mangling.
|
||||
result = Failure()
|
||||
|
||||
if current_context() != expected_context:
|
||||
|
||||
|
|
Loading…
Reference in a new issue