Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix stacktraces when using ObservableDeferred and async/await #6836

Merged
merged 2 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6836.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix stacktraces when using `ObservableDeferred` and async/await.
4 changes: 4 additions & 0 deletions synapse/util/async_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def callback(r):
def errback(f):
object.__setattr__(self, "_result", (False, f))
while self._observers:
# This is a little bit of magic to correctly propagate stack
# traces when we `await` on one of the observer deferreds.
f.value.__failure__ = f

try:
# TODO: Handle errors here.
self._observers.pop().errback(f)
Expand Down