开发者

Are there any conventions on throwing exceptions from implementations of IObserver?

开发者 https://www.devze.com 2023-01-19 04:56 出处:网络
I\'m implementing IObserver. Are there any conventions about th开发者_StackOverflow社区rowing exceptions from IObserver?

I'm implementing IObserver.

Are there any conventions about th开发者_StackOverflow社区rowing exceptions from IObserver?

Can OnNext or any other method of my implementation throw exceptions?

What should happen if exception is thrown in OnNext or OnCompleted - should I catch all exceptions and call this.OnError(ex)?

What will happen if OnError throws?


From previous discussions about this in the Rx forums, the best practice is if OnNext throws, you just let it bubble up to be handled by the Subscribe method, if the user decides to handle it, they will do so.

Actually the answer is not so simple, but you can check out a thread related to your question, here:

More closely related is probably this thread: What if an exception is thrown by the observer in OnNext

0

精彩评论

暂无评论...
验证码 换一张
取 消