diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-12-07 22:05:14 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-12-07 22:05:14 -0500 |
commit | 2c11ce1bff5da9820b3207ad1aa83ac7350741b9 (patch) | |
tree | 54c582259f7932dc1598bb092947162d5f8b7d26 | |
parent | b019dd4f69c9fefeba9f14c2049fb352127e448f (diff) | |
download | SMAPI-2c11ce1bff5da9820b3207ad1aa83ac7350741b9.tar.gz SMAPI-2c11ce1bff5da9820b3207ad1aa83ac7350741b9.tar.bz2 SMAPI-2c11ce1bff5da9820b3207ad1aa83ac7350741b9.zip |
add TypeLoadException details when intercepted by SMAPI
-rw-r--r-- | release-notes.md | 3 | ||||
-rw-r--r-- | src/StardewModdingAPI/Framework/InternalExtensions.cs | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/release-notes.md b/release-notes.md index 3426b622..e92ccf35 100644 --- a/release-notes.md +++ b/release-notes.md @@ -9,8 +9,9 @@ For players: * Tweaked installer wording to avoid confusion. For developers: + * Added a searchable `list_items` command to replace the `out_items`, `out_melee`, and `out_rings` commands. + * Added `TypeLoadException` details when intercepted by SMAPI. * Fixed an issue where you couldn't debug into an assembly because it was copied into the `.cache` directory. That will now only happen if necessary. - * Replaced the `out_items`, `out_melee`, and `out_rings` console commands with `list_items`, which also supports searching. ## 1.3 See [log](https://github.com/CLxS/SMAPI/compare/1.2...1.3). diff --git a/src/StardewModdingAPI/Framework/InternalExtensions.cs b/src/StardewModdingAPI/Framework/InternalExtensions.cs index 71f70fd5..415785d9 100644 --- a/src/StardewModdingAPI/Framework/InternalExtensions.cs +++ b/src/StardewModdingAPI/Framework/InternalExtensions.cs @@ -70,15 +70,21 @@ namespace StardewModdingAPI.Framework /// <param name="exception">The error to summarise.</param> public static string GetLogSummary(this Exception exception) { - string summary = exception.ToString(); + // type load exception + if (exception is TypeLoadException) + return $"Failed loading type: {((TypeLoadException)exception).TypeName}: {exception}"; + // reflection type load exception if (exception is ReflectionTypeLoadException) { + string summary = exception.ToString(); foreach (Exception childEx in ((ReflectionTypeLoadException)exception).LoaderExceptions) summary += $"\n\n{childEx.GetLogSummary()}"; + return summary; } - return summary; + // anything else + return exception.ToString(); } } } |