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.