fix: Add logic to check inner exception

Some exceptions seem to be getting swallowed by the over-arching TypeLoadException. This checks for an InnerException and prints it's message if there is one.
This commit is contained in:
Andrew Welker
2021-07-27 13:16:55 -06:00
parent 28bac18667
commit e84c565a43

View File

@@ -156,6 +156,15 @@ namespace PepperDash.Essentials.Core
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
Debug.Console(2, "{0}", ex.StackTrace);
if (ex.InnerException == null)
{
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Inner exception while creating device {0}: {1}", dc.Key,
ex.InnerException.Message);
Debug.Console(2, "{0}", ex.InnerException.StackTrace);
return null;
}
}