summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-23 17:04:40 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-23 17:04:40 +0000
commitcd85afc6ec9a470e3283d7e62fb60125f26058a9 (patch)
tree49c25424e49ed8b8665b0700bd802af7171dea70 /synapse/util
parentAllow URL-encoded user IDs on user admin api paths (#6825) (diff)
parentFix stacktraces when using ObservableDeferred and async/await (#6836) (diff)
downloadsynapse-cd85afc6ec9a470e3283d7e62fb60125f26058a9.tar.xz
Fix stacktraces when using ObservableDeferred and async/await (#6836)
* commit 'ae5b3104f':
  Fix stacktraces when using ObservableDeferred and async/await (#6836)
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/async_helpers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py
index 04b6abdc24..581dffd8a0 100644
--- a/synapse/util/async_helpers.py
+++ b/synapse/util/async_helpers.py
@@ -73,6 +73,10 @@ class ObservableDeferred(object):
         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)