diff --git a/src/WireMockInspector/ReactiveEx.cs b/src/WireMockInspector/ReactiveEx.cs new file mode 100644 index 0000000..8830780 --- /dev/null +++ b/src/WireMockInspector/ReactiveEx.cs @@ -0,0 +1,10 @@ +using System; +using System.Reactive.Linq; + +namespace WireMockInspector; + +public static class ReactiveEx +{ + public static IObservable DiscardExceptions(this IObservable observable) + => observable.Catch(Observable.Empty()); +} \ No newline at end of file diff --git a/src/WireMockInspector/Views/MainWindow.axaml.cs b/src/WireMockInspector/Views/MainWindow.axaml.cs index 9e3b369..7fc1516 100644 --- a/src/WireMockInspector/Views/MainWindow.axaml.cs +++ b/src/WireMockInspector/Views/MainWindow.axaml.cs @@ -52,10 +52,13 @@ public MainWindow() if (Settings.AutoLoad) { - ViewModel.LoadRequestsCommand.Execute().ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ => - { - ViewModel.RequestSearchTerm = Settings.RequestFilters; - }).DisposeWith(disposables); + ViewModel.LoadRequestsCommand.Execute() + .ObserveOn(RxApp.MainThreadScheduler) + .DiscardExceptions() + .Subscribe(_ => + { + ViewModel.RequestSearchTerm = Settings.RequestFilters; + }).DisposeWith(disposables); } if (string.IsNullOrWhiteSpace(Settings.InstanceName) == false)