mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Migrate files from Wox to PowerLauncher (#5014)
* Moved all files from Wox to Powerlauncher * Removed Wox project * Changed namespace for imported files * Resolved errors for VM * Added build dependency order * Fixed errors in helper class * Remove Wox files * Fixed errors in SingleInstance class * Fixed wox.tests * Fixed MSI * Removed obsolete methods from PublicAPI * nit fixes * Throw null exception * Fix merge conflict
This commit is contained in:
committed by
GitHub
parent
177546bab6
commit
c85cd4ac24
46
src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs
Normal file
46
src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Windows.Threading;
|
||||
using NLog;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Exception;
|
||||
|
||||
namespace PowerLauncher.Helper
|
||||
{
|
||||
public static class ErrorReporting
|
||||
{
|
||||
private static void Report(Exception e)
|
||||
{
|
||||
if( e != null)
|
||||
{
|
||||
var logger = LogManager.GetLogger("UnHandledException");
|
||||
logger.Fatal(ExceptionFormatter.FormatException(e));
|
||||
|
||||
var reportWindow = new ReportWindow(e);
|
||||
reportWindow.Show();
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle non-ui thread exceptions
|
||||
Report((Exception)e?.ExceptionObject);
|
||||
}
|
||||
|
||||
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle ui thread exceptions
|
||||
Report(e?.Exception);
|
||||
//prevent application exist, so the user can copy prompted error info
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
public static string RuntimeInfo()
|
||||
{
|
||||
var info = $"\nVersion: {Constant.Version}" +
|
||||
$"\nOS Version: {Environment.OSVersion.VersionString}" +
|
||||
$"\nIntPtr Length: {IntPtr.Size}" +
|
||||
$"\nx64: {Environment.Is64BitOperatingSystem}";
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user