mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-13 16:49:08 +01:00
Log exceptions from failed Tasks
This commit is contained in:
parent
ee97a49097
commit
85a8677a99
@ -2,6 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
|
||||
namespace DS4Windows
|
||||
@ -154,5 +155,16 @@ namespace DS4Windows
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void LogAssistBackgroundTask(Task task)
|
||||
{
|
||||
task.ContinueWith((t) =>
|
||||
{
|
||||
if (t.IsFaulted)
|
||||
{
|
||||
AppLogger.LogToGui(t.Exception.ToString(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ namespace DS4WinWPF.DS4Forms
|
||||
|
||||
public void LateChecks(ArgumentParser parser)
|
||||
{
|
||||
Task.Run(() =>
|
||||
Task tempTask = Task.Run(() =>
|
||||
{
|
||||
CheckDrivers();
|
||||
if (!parser.Stop)
|
||||
@ -136,7 +136,9 @@ namespace DS4WinWPF.DS4Forms
|
||||
UpdateTheUpdater();
|
||||
});
|
||||
|
||||
Task.Delay(100).ContinueWith((t) =>
|
||||
Util.LogAssistBackgroundTask(tempTask);
|
||||
|
||||
tempTask = Task.Delay(100).ContinueWith((t) =>
|
||||
{
|
||||
int checkwhen = Global.CheckWhen;
|
||||
if (checkwhen > 0 && DateTime.Now >= Global.LastChecked + TimeSpan.FromHours(checkwhen))
|
||||
@ -147,6 +149,7 @@ namespace DS4WinWPF.DS4Forms
|
||||
Global.LastChecked = DateTime.Now;
|
||||
}
|
||||
});
|
||||
Util.LogAssistBackgroundTask(tempTask);
|
||||
}
|
||||
|
||||
private void DownloadUpstreamVersionInfo()
|
||||
|
Loading…
x
Reference in New Issue
Block a user