diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs index a0b22e33f..bf2629dc5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs @@ -1,10 +1,9 @@ -using Flow.Launcher.Infrastructure; +using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Plugin.SharedCommands; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Windows; namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo { @@ -83,7 +82,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo return results; } - throw; +#if DEBUG // Please investigate and handle error from DirectoryInfo search + throw e; +#else + Log.Exception($"|Flow.Launcher.Plugin.Explorer.DirectoryInfoSearch|Error from performing DirectoryInfoSearch", e); +#endif } // Intial ordering, this order can be updated later by UpdateResultView.MainViewModel based on history of user selection. diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs index eda1b21ff..c0e7474d9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs @@ -1,11 +1,8 @@ using Flow.Launcher.Infrastructure.Logger; -using Flow.Launcher.Plugin.SharedCommands; using Microsoft.Search.Interop; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data.OleDb; -using System.Diagnostics; using System.Text.RegularExpressions; namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex @@ -63,13 +60,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex } } } - catch (InvalidOperationException) + catch (InvalidOperationException e) { // Internal error from ExecuteReader(): Connection closed. + LogException("Internal error from ExecuteReader()", e); } - catch (Exception ex) + catch (Exception e) { - Log.Info(ex.ToString());//UPDATE THIS LOGGING + LogException("General error from performing index search", e); } return results; @@ -105,5 +103,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex var indexManager = csm.GetCatalog("SystemIndex").GetCrawlScopeManager(); return indexManager.IncludedInCrawlScope(path) > 0; } + + private void LogException(string message, Exception e) + { +#if DEBUG // Please investigate and handle error from index search + throw e; +#else + Log.Exception($"|Flow.Launcher.Plugin.Explorer.IndexSearch|{message}", e); +#endif + } } }