diff --git a/ConfigGenerator/Logging.cs b/ConfigGenerator/Logging.cs index c69f2d06f..b1894ff71 100644 --- a/ConfigGenerator/Logging.cs +++ b/ConfigGenerator/Logging.cs @@ -39,13 +39,13 @@ namespace ConfigGenerator { MessageBox.Show(message, Resources.Information, MessageBoxButtons.OK, MessageBoxIcon.Information); } - internal static void LogGenericError(string message, [CallerMemberName] string previousMethodName = null) { + internal static void LogGenericErrorWithoutStacktrace(string message) { if (string.IsNullOrEmpty(message)) { LogNullError(nameof(message)); return; } - MessageBox.Show(previousMethodName + @"() " + message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } internal static void LogGenericException(Exception exception, [CallerMemberName] string previousMethodName = null) { @@ -87,5 +87,14 @@ namespace ConfigGenerator { break; } } + + private static void LogGenericError(string message, [CallerMemberName] string previousMethodName = null) { + if (string.IsNullOrEmpty(message)) { + LogNullError(nameof(message)); + return; + } + + LogGenericErrorWithoutStacktrace(previousMethodName + @"() " + message); + } } } diff --git a/ConfigGenerator/MainForm.cs b/ConfigGenerator/MainForm.cs index 606d6cf4c..c263abf8c 100644 --- a/ConfigGenerator/MainForm.cs +++ b/ConfigGenerator/MainForm.cs @@ -87,7 +87,7 @@ namespace ConfigGenerator { if (configPage == ASFTab) { MainTab.SelectedTab = ASFTab; - Logging.LogGenericError("You can't remove global config!"); + Logging.LogGenericErrorWithoutStacktrace("You can't remove global config!"); return; } @@ -109,7 +109,7 @@ namespace ConfigGenerator { if (configPage == ASFTab) { MainTab.SelectedTab = ASFTab; - Logging.LogGenericError("You can't rename global config!"); + Logging.LogGenericErrorWithoutStacktrace("You can't rename global config!"); return; } @@ -121,7 +121,7 @@ namespace ConfigGenerator { } if (string.IsNullOrEmpty(input)) { - Logging.LogGenericError("Your bot name is empty!"); + Logging.LogGenericErrorWithoutStacktrace("Your bot name is empty!"); return; } @@ -147,7 +147,7 @@ namespace ConfigGenerator { } if (string.IsNullOrEmpty(input)) { - Logging.LogGenericError("Your bot name is empty!"); + Logging.LogGenericErrorWithoutStacktrace("Your bot name is empty!"); return; } @@ -155,7 +155,7 @@ namespace ConfigGenerator { input = Regex.Replace(input, @"\s+", ""); if (ASFConfig.ASFConfigs.Select(config => Path.GetFileNameWithoutExtension(config.FilePath)).Any(fileNameWithoutExtension => (fileNameWithoutExtension == null) || fileNameWithoutExtension.Equals(input))) { - Logging.LogGenericError("Bot with such name exists already!"); + Logging.LogGenericErrorWithoutStacktrace("Bot with such name exists already!"); return; } diff --git a/ConfigGenerator/Program.cs b/ConfigGenerator/Program.cs index be9d85f58..bcbb63a40 100644 --- a/ConfigGenerator/Program.cs +++ b/ConfigGenerator/Program.cs @@ -79,7 +79,7 @@ namespace ConfigGenerator { return; } - Logging.LogGenericError("Config directory could not be found!"); + Logging.LogGenericErrorWithoutStacktrace("Config directory could not be found!"); Environment.Exit(1); }