From a6f1981afb94f2dd2a2c76e1ebf95b41770ca3b4 Mon Sep 17 00:00:00 2001 From: Koisu Date: Tue, 24 Jun 2025 11:28:51 -0700 Subject: [PATCH] removed fragile error handling --- .../Helper/RenameThing.cs | 12 ++++++------ .../Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs index b2921710a..f6712453f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs @@ -87,18 +87,18 @@ namespace Flow.Launcher.Plugin.Explorer.Helper case ElementAlreadyExistsException: api.ShowMsgError(string.Format(api.GetTranslation("plugin_explorer_element_already_exists"), NewFileName)); break; - case IOException iOException: - if (iOException.Message.Contains("incorrect")) + default: + string msg = exception.Message; + if (!string.IsNullOrEmpty(msg)) { - api.ShowMsgError(string.Format(api.GetTranslation("plugin_explorer_invalid_name"), NewFileName)); + api.ShowMsgError(string.Format(api.GetTranslation("plugin_explorer_exception"), exception.Message)); return; } else { - goto default; + api.ShowMsgError(api.GetTranslation("plugin_explorer_no_reason_given_exception")); } - default: - api.ShowMsgError(exception.ToString()); + return; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 959738d6b..a9e1eb69a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -203,4 +203,6 @@ Successfully renamed it to: {0} There is already a file with the name: {0} in this location Failed to open rename dialog. + An error occured: {0}. + An error occured and no reason was given.