Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/GitHub.Exports.Reactive/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using GitHub.UI;
using System.Reactive;
using GitHub.Logging;
using ReactiveUI;
using Serilog;

namespace GitHub.ViewModels
{
Expand All @@ -13,5 +15,15 @@ namespace GitHub.ViewModels
/// </remarks>
public abstract class ViewModelBase : ReactiveObject, IViewModel
{
static readonly ILogger logger = LogManager.ForContext<ViewModelBase>();

static ViewModelBase()
{
// We don't really have a better place to hook this up as we don't want to force-load
// rx on package load.
RxApp.DefaultExceptionHandler = Observer.Create<Exception>(
ex => logger.Error(ex, "Unhandled rxui error"),
ex => logger.Error(ex, "Unhandled rxui error"));
}
}
}