mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Include the full stack trace in exception message
The format of this error message used to look like: ```java Expected number (0) of Non-OK status objects in log differs from actual (1). Error while parsing /projC_testTripleDownwardV/h3.h. java.lang.reflect.InvocationTargetException Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.AssertionError: Need to hold a write lock to clear result caches ``` and it was hard to impossible to identify what the cause is. The hope is that capturing this fuller stack trace into the log will make it easier to identify the problem. Part of #117
This commit is contained in:
parent
8c6f501250
commit
1b080ac87e
1 changed files with 9 additions and 1 deletions
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.testplugin.util;
|
package org.eclipse.cdt.core.testplugin.util;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -72,9 +74,15 @@ class LogMonitoring {
|
||||||
cause = cause != null ? cause : t;
|
cause = cause != null ? cause : t;
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
msg.append(t.getMessage() != null ? t.getMessage() : t.getClass().getCanonicalName());
|
msg.append(t.getMessage() != null ? t.getMessage() : t.getClass().getCanonicalName());
|
||||||
|
msg.append("\nStack Trace\n");
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
PrintWriter out = new PrintWriter(writer);
|
||||||
|
t.printStackTrace(out);
|
||||||
|
msg.append(writer.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.append("\n");
|
msg.append("\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue