Global UserInterventionHandler now try/catches

Any exception was borking the callback subscription, so no more interventions were handled
This commit is contained in:
Justin Swanson 2020-01-04 19:31:54 -06:00
parent c9f3fabd69
commit e13b000b54

View File

@ -74,7 +74,29 @@ namespace Wabbajack
Utils.LogMessages
.OfType<IUserIntervention>()
.ObserveOnGuiThread()
.SelectTask(msg => UserInterventionHandlers.Handle(msg))
.SelectTask(async msg =>
{
try
{
await UserInterventionHandlers.Handle(msg);
}
catch (Exception ex)
when (ex.GetType() != typeof(TaskCanceledException))
{
Utils.Error(ex, $"Error while handling user intervention of type {msg?.GetType()}");
try
{
if (!msg.Handled)
{
msg.Cancel();
}
}
catch (Exception cancelEx)
{
Utils.Error(cancelEx, $"Error while cancelling user intervention of type {msg?.GetType()}");
}
}
})
.Subscribe()
.DisposeWith(CompositeDisposable);