mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Better exception report.
This commit is contained in:
@@ -5,31 +5,38 @@ using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using Wox.Core.Exception;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public static class ErrorReporting
|
||||
{
|
||||
private static void Report(Exception e)
|
||||
public static void Report(Exception e)
|
||||
{
|
||||
//if (Debugger.IsAttached) return;
|
||||
if (Debugger.IsAttached) return;
|
||||
Log.Error(ExceptionFormatter.FormatExcpetion(e));
|
||||
new CrashReporter.CrashReporter(e).Show();
|
||||
}
|
||||
|
||||
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Report((Exception)e.ExceptionObject);
|
||||
//handle non-ui thread exceptions
|
||||
App.Window.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
Report((Exception)e.ExceptionObject);
|
||||
if (!(e.ExceptionObject is WoxException))
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle ui thread exceptions
|
||||
Report(e.Exception);
|
||||
}
|
||||
|
||||
public static void ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
Report(e.Exception);
|
||||
//prevent crash
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user