summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-03-01 19:18:21 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-03-01 19:18:21 -0500
commit696bdab3cd3352b439207076d604f21bbcf1d922 (patch)
tree3ecfd2537dddd71e4eedcb1026e650c1908b4d1d /src
parent6de4888a1b3e62f3b3976ba013521fbd79405288 (diff)
downloadSMAPI-696bdab3cd3352b439207076d604f21bbcf1d922.tar.gz
SMAPI-696bdab3cd3352b439207076d604f21bbcf1d922.tar.bz2
SMAPI-696bdab3cd3352b439207076d604f21bbcf1d922.zip
fix errors in console command handlers crashing the game
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Program.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 07857512..ebeefe96 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -535,8 +535,15 @@ namespace StardewModdingAPI
while (true)
{
string input = Console.ReadLine();
- if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
- this.Monitor.Log("Unknown command; type 'help' for a list of available commands.", LogLevel.Error);
+ try
+ {
+ if (!string.IsNullOrWhiteSpace(input) && !this.CommandManager.Trigger(input))
+ this.Monitor.Log("Unknown command; type 'help' for a list of available commands.", LogLevel.Error);
+ }
+ catch (Exception ex)
+ {
+ this.Monitor.Log($"The handler registered for that command failed:\n{ex.GetLogSummary()}", LogLevel.Error);
+ }
}
}