When util.tryWithObserver is used, the scope of error capturing is too wide, so any error from handlers are captured either.
The following example is from the operator all:
local function onNext(...)
util.tryWithObserver(observer, function(...)
if not predicate(...) then
observer:onNext(false)
observer:onCompleted()
end
end, ...)
end
In the above case, the util.tryWithObserver function is covering not only the invoke of the predicate function but also covering the invoke of onNext and onComplete of the Observer.
The observable emits errors from onNext of the observer to onError of the Observer even the error is not from the Observable.
I think util.tryWithObserver function should cover only the invoke of function belong to the Observerable itself.
When
util.tryWithObserveris used, the scope of error capturing is too wide, so any error from handlers are captured either.The following example is from the operator
all:In the above case, the
util.tryWithObserverfunction is covering not only the invoke of thepredicatefunction but also covering the invoke ofonNextandonCompleteof theObserver.The observable emits errors from
onNextof the observer toonErrorof theObservereven the error is not from theObservable.I think
util.tryWithObserverfunction should cover only the invoke of function belong to theObserverableitself.