c# - 响应式 .NET (RX) 通过返回相同的 Observable 嵌套捕获
问题描述
我想介绍一些特定的错误捕获例程,然后重试订阅相同的 observable。这有什么缺点吗:
public static IObservable<int> GetObservable()
{
return Observable.Interval(TimeSpan.Zero)
.Select(x =>
{
Console.WriteLine($"Throwing");
throw new Exception("ups");
return Observable.Return(1);
}).SelectMany(x => x)
.Catch<int, Exception>(ex =>
{
return GetObservable().SubscribeOn(Scheduler.Default);
});
}
Catch 是否真的有一些东西,不应该以这种方式使用?有什么影响?是否应该将Catch
其视为“使用一次”例程,Do
然后在底部使用时进行异常检查Retry
?
解决方案
推荐阅读
- python - CSV 文件和类型错误:类似字节的对象
- git - 推送到 bitbucket 存储库时出现“致命:身份验证失败”错误
- javascript - 用于为背景图像生成内联 CSS 样式的 Webpack JS 模板字符串:url()
- laravel-5.6 - 回复:Laravel 通知(在 null 上调用成员函数 notifyNow())
- reactjs - 使用 react-router Redirect 切换页面时如何获取 Google Analytics url 参数信息
- android - 具有不同样式的默认警报对话框
- java - Micronaut:测试失败,页面未找到,但可以通过浏览器正常访问页面
- html - 画布内卡片的最大尺寸
- ios - AVPlayerLooper 没有循环播放我的本地视频
- python - Keras LSTM如何使用多对多的模型进行训练以进行有状态=真的一对多的预测?