Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Boilerplate Windows client's exception handling (#8622) #8633

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ private void App_DispatcherUnhandledException(object sender, System.Windows.Thre
{
((MainWindow)MainWindow).AppWebView.Services.GetRequiredService<IExceptionHandler>().Handle(e.Exception);
}
catch { }
catch
{
var errorMessage = e.Exception.ToString();
System.Windows.Clipboard.SetText(errorMessage);
System.Windows.Forms.MessageBox.Show(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

e.Handled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public static void Main(string[] args)
var application = new App();
Task.Run(async () =>
{
var services = await App.Current.Dispatcher.InvokeAsync(() => ((MainWindow)App.Current.MainWindow).AppWebView.Services);
try
{
var services = await App.Current.Dispatcher.InvokeAsync(() => ((MainWindow)App.Current.MainWindow).AppWebView.Services);
var windowsUpdateSettings = services.GetRequiredService<IOptionsSnapshot<WindowsUpdateSettings>>().Value;
if (windowsUpdateSettings?.FilesUrl is null)
if (string.IsNullOrEmpty(windowsUpdateSettings?.FilesUrl))
{
return;
}
Expand All @@ -43,7 +43,10 @@ public static void Main(string[] args)
}
}
}
catch { }
catch (Exception exp)
{
services.GetRequiredService<IExceptionHandler>().Handle(exp);
}
});
application.Run();
}
Expand Down
Loading