mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-25 18:42:08 -05:00
Don't forget to log inner exception of handled errors, if it exists.
This commit is contained in:
parent
454b078034
commit
fe5266d959
1 changed files with 8 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue