mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 11:51:56 +00:00
Add logging to ObservableDeferred callbacks (#9523)
This commit is contained in:
parent
0764d0c6e5
commit
9898470e7d
1
changelog.d/9523.misc
Normal file
1
changelog.d/9523.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add extra logging to ObservableDeferred when callbacks throw exceptions.
|
@ -76,11 +76,16 @@ class ObservableDeferred:
|
|||||||
def callback(r):
|
def callback(r):
|
||||||
object.__setattr__(self, "_result", (True, r))
|
object.__setattr__(self, "_result", (True, r))
|
||||||
while self._observers:
|
while self._observers:
|
||||||
|
observer = self._observers.pop()
|
||||||
try:
|
try:
|
||||||
# TODO: Handle errors here.
|
observer.callback(r)
|
||||||
self._observers.pop().callback(r)
|
except Exception as e:
|
||||||
except Exception:
|
logger.exception(
|
||||||
pass
|
"%r threw an exception on .callback(%r), ignoring...",
|
||||||
|
observer,
|
||||||
|
r,
|
||||||
|
exc_info=e,
|
||||||
|
)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def errback(f):
|
def errback(f):
|
||||||
@ -90,11 +95,16 @@ class ObservableDeferred:
|
|||||||
# traces when we `await` on one of the observer deferreds.
|
# traces when we `await` on one of the observer deferreds.
|
||||||
f.value.__failure__ = f
|
f.value.__failure__ = f
|
||||||
|
|
||||||
|
observer = self._observers.pop()
|
||||||
try:
|
try:
|
||||||
# TODO: Handle errors here.
|
observer.errback(f)
|
||||||
self._observers.pop().errback(f)
|
except Exception as e:
|
||||||
except Exception:
|
logger.exception(
|
||||||
pass
|
"%r threw an exception on .errback(%r), ignoring...",
|
||||||
|
observer,
|
||||||
|
f,
|
||||||
|
exc_info=e,
|
||||||
|
)
|
||||||
|
|
||||||
if consumeErrors:
|
if consumeErrors:
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user