Don't forget to log inner exception of handled errors, if it exists.

This commit is contained in:
UnknownShadow200 2018-01-08 20:39:54 +11:00
parent 454b078034
commit fe5266d959

View file

@ -81,11 +81,17 @@ namespace ClassicalSharp {
/// <summary> Logs a handled exception that occured at the specified location to the log file. </summary>
public static bool LogError(string location, Exception ex) {
string error = ex.GetType().FullName + ": " + ex.Message
+ Environment.NewLine + ex.StackTrace;
string error = DescribeException(ex);
if (ex.InnerException != null) {
error += Environment.NewLine + DescribeException(ex.InnerException);
}
return LogError(location, error);
}
static string DescribeException(Exception ex) {
return ex.GetType().FullName + ": " + ex.Message + Environment.NewLine + ex.StackTrace;
}
/// <summary> Logs an error that occured at the specified location to the log file. </summary>
public static bool LogError(string location, string text) {
try {