This commit is contained in:
JustArchi
2016-05-30 02:06:04 +02:00
parent ff971f7615
commit c2a1c160e0
3 changed files with 17 additions and 8 deletions

View File

@@ -39,13 +39,13 @@ namespace ConfigGenerator {
MessageBox.Show(message, Resources.Information, MessageBoxButtons.OK, MessageBoxIcon.Information); 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)) { if (string.IsNullOrEmpty(message)) {
LogNullError(nameof(message)); LogNullError(nameof(message));
return; 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) { internal static void LogGenericException(Exception exception, [CallerMemberName] string previousMethodName = null) {
@@ -87,5 +87,14 @@ namespace ConfigGenerator {
break; break;
} }
} }
private static void LogGenericError(string message, [CallerMemberName] string previousMethodName = null) {
if (string.IsNullOrEmpty(message)) {
LogNullError(nameof(message));
return;
}
LogGenericErrorWithoutStacktrace(previousMethodName + @"() " + message);
}
} }
} }

View File

@@ -87,7 +87,7 @@ namespace ConfigGenerator {
if (configPage == ASFTab) { if (configPage == ASFTab) {
MainTab.SelectedTab = ASFTab; MainTab.SelectedTab = ASFTab;
Logging.LogGenericError("You can't remove global config!"); Logging.LogGenericErrorWithoutStacktrace("You can't remove global config!");
return; return;
} }
@@ -109,7 +109,7 @@ namespace ConfigGenerator {
if (configPage == ASFTab) { if (configPage == ASFTab) {
MainTab.SelectedTab = ASFTab; MainTab.SelectedTab = ASFTab;
Logging.LogGenericError("You can't rename global config!"); Logging.LogGenericErrorWithoutStacktrace("You can't rename global config!");
return; return;
} }
@@ -121,7 +121,7 @@ namespace ConfigGenerator {
} }
if (string.IsNullOrEmpty(input)) { if (string.IsNullOrEmpty(input)) {
Logging.LogGenericError("Your bot name is empty!"); Logging.LogGenericErrorWithoutStacktrace("Your bot name is empty!");
return; return;
} }
@@ -147,7 +147,7 @@ namespace ConfigGenerator {
} }
if (string.IsNullOrEmpty(input)) { if (string.IsNullOrEmpty(input)) {
Logging.LogGenericError("Your bot name is empty!"); Logging.LogGenericErrorWithoutStacktrace("Your bot name is empty!");
return; return;
} }
@@ -155,7 +155,7 @@ namespace ConfigGenerator {
input = Regex.Replace(input, @"\s+", ""); input = Regex.Replace(input, @"\s+", "");
if (ASFConfig.ASFConfigs.Select(config => Path.GetFileNameWithoutExtension(config.FilePath)).Any(fileNameWithoutExtension => (fileNameWithoutExtension == null) || fileNameWithoutExtension.Equals(input))) { 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; return;
} }

View File

@@ -79,7 +79,7 @@ namespace ConfigGenerator {
return; return;
} }
Logging.LogGenericError("Config directory could not be found!"); Logging.LogGenericErrorWithoutStacktrace("Config directory could not be found!");
Environment.Exit(1); Environment.Exit(1);
} }