Skip to content
Merged
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions src/Files.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ public static void SaveSessionTabs() // Enumerates through all tabs and gets the
}

// Occurs when an exception is not handled on the UI thread.
private static void OnUnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception);
private static void OnUnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception, true);

// Occurs when an exception is not handled on a background thread.
// ie. A task is fired and forgotten Task.Run(() => {...})
private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) => AppUnhandledException(e.Exception);
private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) => AppUnhandledException(e.Exception, false);

private static void AppUnhandledException(Exception ex)
private static void AppUnhandledException(Exception ex, bool shouldShowNotification)
{
StringBuilder formattedException = new StringBuilder() { Capacity = 200 };

Expand Down Expand Up @@ -385,7 +385,7 @@ private static void AppUnhandledException(Exception ex)

SaveSessionTabs();
Logger.UnhandledError(ex, ex.Message);
if (ShowErrorNotification)
if (ShowErrorNotification && shouldShowNotification)
{
var toastContent = new ToastContent()
{
Expand Down