From da6dfcdf6d9b7a15bd069b14f9555e3653b166a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BC=98=E9=9F=AC?= Date: Sun, 13 Jun 2021 22:33:51 +0800 Subject: [PATCH] CherryPick DirectoryInfoSearch.cs Exception Refactor --- .../Search/DirectoryInfo/DirectoryInfoSearch.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs index 14833bae9..14c90d57f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs @@ -21,7 +21,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo RecurseSubdirectories = true }, query, search, criteria, token); - return DirectorySearch(new EnumerationOptions(), query, search, criteria, token); // null will be passed as default + return DirectorySearch(new EnumerationOptions(), query, search, criteria, + token); // null will be passed as default } public static string ConstructSearchCriteria(string search) @@ -57,7 +58,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo { var directoryInfo = new System.IO.DirectoryInfo(path); - foreach (var fileSystemInfo in directoryInfo.EnumerateFileSystemInfos(searchCriteria, enumerationOption)) + foreach (var fileSystemInfo in directoryInfo.EnumerateFileSystemInfos(searchCriteria, enumerationOption) + ) { if (fileSystemInfo is System.IO.DirectoryInfo) { @@ -74,17 +76,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo } catch (Exception e) { - if (!(e is ArgumentException)) - throw e; - + Log.Exception("Flow.Plugin.Explorer.", nameof(DirectoryInfoSearch), e); results.Add(new Result {Title = e.Message, Score = 501}); return results; - -#if DEBUG // Please investigate and handle error from DirectoryInfo search -#else - Log.Exception($"|Flow.Launcher.Plugin.Explorer.DirectoryInfoSearch|Error from performing DirectoryInfoSearch", e); -#endif } // Initial ordering, this order can be updated later by UpdateResultView.MainViewModel based on history of user selection.