mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Log first change exception
This commit is contained in:
parent
87497d2d09
commit
cf9c41f437
20 changed files with 92 additions and 71 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -286,7 +286,7 @@ paket-files/
|
|||
*.VC.db
|
||||
|
||||
## Wox specific
|
||||
|
||||
Output/*
|
||||
/Python.Runtime.dll
|
||||
Wox/Images/websearch/Thumbs.db
|
||||
Wox/Images/Thumbs.db
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Wox.Plugin.CMD
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
catch (WebException e)
|
||||
{
|
||||
Log.Warn("Can't connect to Wox plugin website, check your conenction");
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return new List<Result>();
|
||||
}
|
||||
List<WoxPluginResult> searchedPlugins;
|
||||
|
|
@ -129,7 +129,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
catch(JsonSerializationException e)
|
||||
{
|
||||
context.API.ShowMsg("Coundn't parse api search results", "Please update your Wox!", string.Empty);
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
var info = "download plugin " + r.name + "failed.";
|
||||
MessageBox.Show(info);
|
||||
Log.Warn(info);
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return false;
|
||||
}
|
||||
context.API.InstallPlugin(filePath);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Wox.Plugin.Program.ProgramSources
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Wox.Plugin.Program.ProgramSources
|
|||
catch (Exception e)
|
||||
{
|
||||
var woxPluginException = new WoxPluginException("Program", $"GetAppFromDirectory failed: {path}", e);
|
||||
Log.Error(woxPluginException);
|
||||
Log.Exception(woxPluginException);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
catch (WebException e)
|
||||
{
|
||||
Log.Warn("Can't get suggestion from baidu");
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return new List<string>(); ;
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
catch (WebException e)
|
||||
{
|
||||
Log.Warn("Can't get suggestion from google");
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return new List<string>(); ;
|
||||
}
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
|
|
@ -35,7 +35,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return new List<string>();
|
||||
}
|
||||
if (json != null)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ namespace Wox.Core.Plugin
|
|||
catch (Exception e)
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: json format is not valid";
|
||||
Log.Error(new WoxException(msg));
|
||||
Log.Exception(new WoxException(msg));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -86,14 +86,14 @@ namespace Wox.Core.Plugin
|
|||
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}";
|
||||
Log.Error(new WoxException(msg));
|
||||
Log.Exception(new WoxException(msg));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!File.Exists(metadata.ExecuteFilePath))
|
||||
{
|
||||
string msg = $"Parse plugin config {configPath} failed: ExecuteFile {metadata.ExecuteFilePath} didn't exist";
|
||||
Log.Error(new WoxException(msg));
|
||||
Log.Exception(new WoxException(msg));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(new WoxPluginException(metadata.Name, "Couldn't load plugin context menus", e));
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Couldn't load plugin context menus", e));
|
||||
return new List<Result>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(new WoxPluginException(metadata.Name, "Couldn't load assembly", e));
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Couldn't load assembly", e));
|
||||
continue;
|
||||
}
|
||||
var types = assembly.GetTypes();
|
||||
|
|
@ -50,7 +50,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Log.Error(new WoxPluginException(metadata.Name, "Can't find class implement IPlugin", e));
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Can't find class implement IPlugin", e));
|
||||
continue;
|
||||
}
|
||||
IPlugin plugin;
|
||||
|
|
@ -60,7 +60,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(new WoxPluginException(metadata.Name, "Can't create instance", e));
|
||||
Log.Exception(new WoxPluginException(metadata.Name, "Can't create instance", e));
|
||||
continue;
|
||||
}
|
||||
PluginPair pair = new PluginPair
|
||||
|
|
@ -90,13 +90,13 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.Error(new WoxException("Python can't be found in PATH."));
|
||||
Log.Exception(new WoxException("Python can't be found in PATH."));
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error(new WoxException("Path variable is not set."));
|
||||
Log.Exception(new WoxException("Path variable is not set."));
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ namespace Wox.Core.Plugin
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.Error(new WoxException("Can't find python executable in python directory"));
|
||||
Log.Exception(new WoxException("Can't find python executable in python directory"));
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Wox.Core.Resource
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ namespace Wox.Core.Resource
|
|||
catch (Exception e)
|
||||
{
|
||||
var woxPluginException = new WoxPluginException(pluginPair.Metadata.Name, "Update Plugin metadata translation failed:", e);
|
||||
Log.Error(woxPluginException);
|
||||
Log.Exception(woxPluginException);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Wox.Core.Resource
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ namespace Wox.Core
|
|||
}
|
||||
catch (HttpRequestException he)
|
||||
{
|
||||
Log.Error(he);
|
||||
Log.Exception(he);
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
Log.Error(we);
|
||||
Log.Exception(we);
|
||||
}
|
||||
catch (SocketException sc)
|
||||
{
|
||||
Log.Info("Socket exception happened!, which method cause this exception??");
|
||||
Log.Error(sc);
|
||||
Log.Exception(sc);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
|
@ -72,7 +72,7 @@ namespace Wox.Core
|
|||
catch (WebException e)
|
||||
{
|
||||
Log.Warn("Can't connect to github api to check new version");
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace Wox.Core
|
|||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return string.Empty;
|
||||
}
|
||||
var version = json?["tag_name"]?.ToString();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace Wox.Infrastructure.Image
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return ImageSources[ErrorIcon];
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ namespace Wox.Infrastructure.Image
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
return ImageSources[ErrorIcon];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,29 @@ namespace Wox.Infrastructure.Logger
|
|||
var type = $"{method.DeclaringType.NonNull().FullName}.{method.Name}";
|
||||
return type;
|
||||
}
|
||||
public static void Error(System.Exception e)
|
||||
|
||||
public static void Error(string msg)
|
||||
{
|
||||
var type = CallerType();
|
||||
var logger = LogManager.GetLogger(type);
|
||||
System.Diagnostics.Debug.WriteLine($"ERROR: {msg}");
|
||||
logger.Error(msg);
|
||||
}
|
||||
|
||||
public static void Exception(System.Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
throw e;
|
||||
#else
|
||||
while (e.InnerException != null)
|
||||
var type = CallerType();
|
||||
var logger = LogManager.GetLogger(type);
|
||||
|
||||
do
|
||||
{
|
||||
logger.Error(e.Message);
|
||||
logger.Error(e.StackTrace);
|
||||
logger.Error($"\n{e.StackTrace}");
|
||||
e = e.InnerException;
|
||||
}
|
||||
} while (e != null);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ namespace Wox.Infrastructure.Storage
|
|||
}
|
||||
catch (SerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
LoadDefault();
|
||||
}
|
||||
catch (InvalidCastException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
LoadDefault();
|
||||
}
|
||||
finally
|
||||
|
|
@ -114,7 +114,7 @@ namespace Wox.Infrastructure.Storage
|
|||
}
|
||||
catch (SerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Wox.Infrastructure.Storage
|
|||
catch (JsonSerializationException e)
|
||||
{
|
||||
LoadDefault();
|
||||
Log.Error(e);
|
||||
Log.Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Wox.Core.Plugin;
|
|||
using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.ViewModel;
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
|
|
@ -22,7 +23,8 @@ namespace Wox
|
|||
[STAThread]
|
||||
public static void Main()
|
||||
{
|
||||
RegisterAppDomainUnhandledException();
|
||||
RegisterAppDomainExceptions();
|
||||
|
||||
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
|
||||
{
|
||||
using (var application = new App())
|
||||
|
|
@ -74,18 +76,31 @@ namespace Wox
|
|||
Current.Exit += (s, e) => Dispose();
|
||||
Current.SessionEnding += (s, e) => Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// let exception throw as normal is better for Debug
|
||||
/// </summary>
|
||||
[Conditional("RELEASE")]
|
||||
private void RegisterDispatcherUnhandledException()
|
||||
{
|
||||
// let exception throw as normal is better for Debug
|
||||
DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// let exception throw as normal is better for Debug
|
||||
/// </summary>
|
||||
[Conditional("RELEASE")]
|
||||
private static void RegisterAppDomainUnhandledException()
|
||||
private static void RegisterAppDomainExceptions()
|
||||
{
|
||||
// let exception throw as normal is better for Debug
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle;
|
||||
AppDomain.CurrentDomain.FirstChanceException += (s, e) =>
|
||||
{
|
||||
Log.Error("First Chance Exception:");
|
||||
Log.Exception(e.Exception);
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -405,29 +405,30 @@
|
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
|
||||
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
|
||||
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
|
||||
xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
|
||||
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
|
||||
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
|
||||
|
||||
cd $(SolutionDir)packages\squirrel*\tools
|
||||
copy /Y Squirrel.exe $(TargetDir)..\Update.exe
|
||||
cd $(SolutionDir)
|
||||
|
||||
|
||||
if $(ConfigurationName) == Release (
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.config
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q ICSharpCode.SharpZipLib.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NAppUpdate.Framework.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Newtonsoft.Json.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q JetBrains.Annotations.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Pinyin4Net.dll
|
||||
|
||||
cd "$(TargetDir)" & del /s /q *.xml
|
||||
)
|
||||
if $(ConfigurationName) == Release (
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.config
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q ICSharpCode.SharpZipLib.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NAppUpdate.Framework.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Newtonsoft.Json.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q JetBrains.Annotations.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Pinyin4Net.dll
|
||||
cd "$(TargetDir)" & del /s /q *.xml
|
||||
)
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
|
@ -438,11 +439,6 @@
|
|||
!-->
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' And '$(APPVEYOR_BUILD_FOLDER)' == '' ">
|
||||
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
|
||||
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
|
||||
</GetAssemblyIdentity>
|
||||
<Exec Command="nuget pack $(SolutionDir)Deploy\wox.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(TargetDir) -BasePath $(TargetDir)" />
|
||||
<Exec Command="squirrel --releasify $(TargetDir)Wox.%(myAssemblyInfo.Version).nupkg --releaseDir $(TargetDir)Installer --no-msi" />
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
</Project>
|
||||
Loading…
Reference in a new issue