Skip to content

Commit 6b54ca2

Browse files
committed
Silent handle TaskSchedulerUnobservedTaskException
1 parent 367bf2c commit 6b54ca2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Flow.Launcher/Helper/ErrorReporting.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ namespace Flow.Launcher.Helper;
1111

1212
public static class ErrorReporting
1313
{
14-
private static void Report(Exception e, [CallerMemberName] string methodName = "UnHandledException")
14+
private static void Report(Exception e, bool silent = false, [CallerMemberName] string methodName = "UnHandledException")
1515
{
1616
var logger = LogManager.GetLogger(methodName);
1717
logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
18+
if (silent) return;
1819
var reportWindow = new ReportWindow(e);
1920
reportWindow.Show();
2021
}
@@ -36,7 +37,7 @@ public static void DispatcherUnhandledException(object sender, DispatcherUnhandl
3637
public static void TaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
3738
{
3839
// handle unobserved task exceptions on UI thread
39-
Application.Current.Dispatcher.Invoke(() => Report(e.Exception));
40+
Application.Current.Dispatcher.Invoke(() => Report(e.Exception, true));
4041
// prevent application exit, so the user can copy the prompted error info
4142
e.SetObserved();
4243
}

0 commit comments

Comments
 (0)