Add logging to ObservableDeferred callbacks (#9523)
This commit is contained in:
parent
0764d0c6e5
commit
9898470e7d
|
@ -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