Reputation: 9252
I have designed what is essentially a propertychanged listener - i.e. when Instance.A changes, call OnAChanged()
Observable.FromEventPattern<PropertyChangedEventArgs>(Instance,"PropertyChanged")
.Where(e => e.EventArgs.PropertyName == "A")
.ObserveOn(Scheduler.ThreadPool)
.Subscribe(search =>
OnAChanged((PropertyChangedEventArgsEx)search.EventArgs), s =>
OnError(s));
This works totally fine (without the s => OnError(s)
part).
However, I wanted to test exception handling. I modified by OnAChanged()
method to just throw a new exception. However, the exception is thrown, and OnError
never gets called, and my application crashes. Am I misunderstanding the usage of OnError
?
Upvotes: 0
Views: 431
Reputation: 74654
You are misunderstanding OnError - OnError is a property of the IObservable. Event-based IObservables never OnError (because there's no such thing as an "Event Exception" or something). If you had a different source, like Observable.Start, you could see the OnError.
Upvotes: 1