Also log LoaderExceptions for ReflectionTypeLoadException exceptions

This commit is contained in:
UnknownShadow200 2020-07-14 13:48:56 +10:00
parent abe43b75e1
commit 94e97a12d1
3 changed files with 15 additions and 2 deletions

View File

@ -25,7 +25,7 @@ using MCGalaxy.Tasks;
namespace MCGalaxy.Core {
public sealed class CorePlugin : Plugin_Simple {
public sealed class CorePlugin : Plugin {
public override string creator { get { return Server.SoftwareName + " team"; } }
public override string MCGalaxy_Version { get { return Server.Version; } }
public override string name { get { return "CorePlugin"; } }

View File

@ -20,7 +20,7 @@ using MCGalaxy.Events;
namespace MCGalaxy.Core {
public sealed class NotesPlugin : Plugin_Simple {
public sealed class NotesPlugin : Plugin {
public override string creator { get { return Server.SoftwareName + " team"; } }
public override string MCGalaxy_Version { get { return Server.Version; } }
public override string name { get { return "Core_NotesPlugin"; } }

View File

@ -16,6 +16,7 @@
permissions and limitations under the Licenses.
*/
using System;
using System.Reflection;
using System.Text;
namespace MCGalaxy {
@ -130,6 +131,18 @@ namespace MCGalaxy {
try { sb.AppendLine("Message: " + ex.Message); } catch { }
try { sb.AppendLine("Target: " + ex.TargetSite.Name); } catch { }
try { sb.AppendLine("Trace: " + ex.StackTrace); } catch { }
// For errors with loading plugins (e.g. missing dependancy) you get a
// Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
// which is pretty useless by itself, so check specifically for this case
try {
ReflectionTypeLoadException refEx = ex as ReflectionTypeLoadException;
if (refEx == null) return;
sb.AppendLine("## Loader exceptions ##");
foreach (Exception loadEx in refEx.LoaderExceptions)
DescribeError(loadEx, sb);
} catch { }
}
}
}