From 2dc37cd6accbda656fd2829431a931bd6f62d52b Mon Sep 17 00:00:00 2001 From: That_One_Nerd Date: Tue, 25 Apr 2023 17:19:07 -0400 Subject: [PATCH] Debug mode gives better errors now (tiny patch) --- SrcMod/Shell/Shell.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SrcMod/Shell/Shell.cs b/SrcMod/Shell/Shell.cs index 58cd52e..161cfa0 100644 --- a/SrcMod/Shell/Shell.cs +++ b/SrcMod/Shell/Shell.cs @@ -237,24 +237,27 @@ public class Shell void runCommand(object? sender, DoWorkEventArgs e) { -#if RELEASE try { -#endif command.Invoke(args); -#if RELEASE } +#if RELEASE catch (TargetInvocationException ex) { Write($"[ERROR] {ex.InnerException!.Message}", ConsoleColor.Red); if (LoadingBar.Enabled) LoadingBar.End(); } +#endif catch (Exception ex) { +#if RELEASE Write($"[ERROR] {ex.Message}", ConsoleColor.Red); if (LoadingBar.Enabled) LoadingBar.End(); - } +#else + Write($"[ERROR] {ex}", ConsoleColor.Red); + if (LoadingBar.Enabled) LoadingBar.End(); #endif + } } activeCommand = new();