Simplify casting of ReflectionTypeLoadException

This commit is contained in:
Aireil 2021-02-15 13:26:57 +01:00
parent 34a1eb0b9c
commit 2e4f11b2ad
2 changed files with 2 additions and 4 deletions

View file

@ -104,8 +104,7 @@ namespace Dalamud.Plugin
}
catch (Exception ex) {
Log.Error(ex, $"Plugin load for {dllFile.FullName} failed.");
if (ex is ReflectionTypeLoadException) {
var typeLoadException = ex as ReflectionTypeLoadException;
if (ex is ReflectionTypeLoadException typeLoadException) {
foreach (var exception in typeLoadException.LoaderExceptions) {
Log.Error(exception, "LoaderException:");
}

View file

@ -152,8 +152,7 @@ namespace Dalamud.Plugin
}
catch (Exception ex) {
Log.Error(ex, "Plugin download failed hard.");
if (ex is ReflectionTypeLoadException) {
var typeLoadException = ex as ReflectionTypeLoadException;
if (ex is ReflectionTypeLoadException typeLoadException) {
foreach (var exception in typeLoadException.LoaderExceptions) {
Log.Error(exception, "LoaderException:");
}