Skip to content

Commit a196c4f

Browse files
committed
add logging to Index and DirectoryInfo search
1 parent 407864b commit a196c4f

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
using Flow.Launcher.Infrastructure;
1+
using Flow.Launcher.Infrastructure.Logger;
22
using Flow.Launcher.Plugin.SharedCommands;
33
using System;
44
using System.Collections.Generic;
55
using System.IO;
66
using System.Linq;
7-
using System.Windows;
87

98
namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo
109
{
@@ -83,7 +82,11 @@ private List<Result> DirectorySearch(SearchOption searchOption, Query query, str
8382
return results;
8483
}
8584

86-
throw;
85+
#if DEBUG // Please investigate and handle error from DirectoryInfo search
86+
throw e;
87+
#else
88+
Log.Exception($"|Flow.Launcher.Plugin.Explorer.DirectoryInfoSearch|Error from performing DirectoryInfoSearch", e);
89+
#endif
8790
}
8891

8992
// Intial ordering, this order can be updated later by UpdateResultView.MainViewModel based on history of user selection.

Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using Flow.Launcher.Infrastructure.Logger;
2-
using Flow.Launcher.Plugin.SharedCommands;
32
using Microsoft.Search.Interop;
43
using System;
54
using System.Collections.Generic;
6-
using System.ComponentModel;
75
using System.Data.OleDb;
8-
using System.Diagnostics;
96
using System.Text.RegularExpressions;
107

118
namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
@@ -63,13 +60,14 @@ internal List<Result> ExecuteWindowsIndexSearch(string indexQueryString, string
6360
}
6461
}
6562
}
66-
catch (InvalidOperationException)
63+
catch (InvalidOperationException e)
6764
{
6865
// Internal error from ExecuteReader(): Connection closed.
66+
LogException("Internal error from ExecuteReader()", e);
6967
}
70-
catch (Exception ex)
68+
catch (Exception e)
7169
{
72-
Log.Info(ex.ToString());//UPDATE THIS LOGGING
70+
LogException("General error from performing index search", e);
7371
}
7472

7573
return results;
@@ -105,5 +103,14 @@ internal bool PathIsIndexed(string path)
105103
var indexManager = csm.GetCatalog("SystemIndex").GetCrawlScopeManager();
106104
return indexManager.IncludedInCrawlScope(path) > 0;
107105
}
106+
107+
private void LogException(string message, Exception e)
108+
{
109+
#if DEBUG // Please investigate and handle error from index search
110+
throw e;
111+
#else
112+
Log.Exception($"|Flow.Launcher.Plugin.Explorer.IndexSearch|{message}", e);
113+
#endif
114+
}
108115
}
109116
}

0 commit comments

Comments
 (0)