mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add global unhandled exception check.
This commit is contained in:
parent
79d011bd5c
commit
8ef6827bd9
1 changed files with 16 additions and 0 deletions
|
|
@ -45,6 +45,9 @@ namespace Wox
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
|
||||
progressBar.ToolTip = toolTip;
|
||||
InitialTray();
|
||||
resultCtrl.OnMouseClickItem += AcceptSelect;
|
||||
|
|
@ -64,6 +67,19 @@ namespace Wox
|
|||
SetCustomPluginHotkey();
|
||||
}
|
||||
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (!System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
string error = "Wox has an error that can't be handled. " + e.ExceptionObject;
|
||||
Log.Error(error);
|
||||
if (e.IsTerminating)
|
||||
{
|
||||
MessageBox.Show(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
||||
{
|
||||
var hotkey = new HotkeyModel(hotkeyStr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue