diff options
author | Erik Johnston <erik@matrix.org> | 2020-02-03 17:10:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 17:10:54 +0000 |
commit | ae5b3104f0023171b2bb89f08a066e5974ee7666 (patch) | |
tree | d18cb7d8307bbc6314fa1c4178ddbf69a5dbf849 | |
parent | Allow URL-encoded user IDs on user admin api paths (#6825) (diff) | |
download | synapse-ae5b3104f0023171b2bb89f08a066e5974ee7666.tar.xz |
Fix stacktraces when using ObservableDeferred and async/await (#6836)
Diffstat (limited to '')
-rw-r--r-- | changelog.d/6836.misc | 1 | ||||
-rw-r--r-- | synapse/util/async_helpers.py | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.d/6836.misc b/changelog.d/6836.misc new file mode 100644 index 0000000000..232488e1e5 --- /dev/null +++ b/changelog.d/6836.misc @@ -0,0 +1 @@ +Fix stacktraces when using `ObservableDeferred` and async/await. 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) |