Skip to content

Commit da6dfcd

Browse files
committed
CherryPick DirectoryInfoSearch.cs Exception Refactor
1 parent b955fde commit da6dfcd

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ internal static List<Result> TopLevelDirectorySearch(Query query, string search,
2121
RecurseSubdirectories = true
2222
}, query, search, criteria, token);
2323

24-
return DirectorySearch(new EnumerationOptions(), query, search, criteria, token); // null will be passed as default
24+
return DirectorySearch(new EnumerationOptions(), query, search, criteria,
25+
token); // null will be passed as default
2526
}
2627

2728
public static string ConstructSearchCriteria(string search)
@@ -57,7 +58,8 @@ private static List<Result> DirectorySearch(EnumerationOptions enumerationOption
5758
{
5859
var directoryInfo = new System.IO.DirectoryInfo(path);
5960

60-
foreach (var fileSystemInfo in directoryInfo.EnumerateFileSystemInfos(searchCriteria, enumerationOption))
61+
foreach (var fileSystemInfo in directoryInfo.EnumerateFileSystemInfos(searchCriteria, enumerationOption)
62+
)
6163
{
6264
if (fileSystemInfo is System.IO.DirectoryInfo)
6365
{
@@ -74,17 +76,10 @@ private static List<Result> DirectorySearch(EnumerationOptions enumerationOption
7476
}
7577
catch (Exception e)
7678
{
77-
if (!(e is ArgumentException))
78-
throw e;
79-
79+
Log.Exception("Flow.Plugin.Explorer.", nameof(DirectoryInfoSearch), e);
8080
results.Add(new Result {Title = e.Message, Score = 501});
8181

8282
return results;
83-
84-
#if DEBUG // Please investigate and handle error from DirectoryInfo search
85-
#else
86-
Log.Exception($"|Flow.Launcher.Plugin.Explorer.DirectoryInfoSearch|Error from performing DirectoryInfoSearch", e);
87-
#endif
8883
}
8984

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

0 commit comments

Comments
 (0)