Improve exception reporting

Add the source spec in the error stacktrace

Original commit: elastic/x-pack-elasticsearch@bc7ed6ac60
This commit is contained in:
Costin Leau 2017-07-04 19:25:03 +03:00
parent 6f670c8d8e
commit 12e12f7a94
3 changed files with 3 additions and 4 deletions

View File

@ -84,7 +84,7 @@ public class CsvSpecIntegrationTest extends SpecBaseIntegrationTestCase {
throw reworkException(new AssertionError(errorMessage(ae), ae.getCause()));
}
} catch (Throwable th) {
throw new RuntimeException(errorMessage(th), th);
throw reworkException(th);
}
}

View File

@ -58,7 +58,7 @@ public abstract class SpecBaseIntegrationTestCase extends ESTestCase {
StackTraceElement[] stackTrace = th.getStackTrace();
StackTraceElement[] redone = new StackTraceElement[stackTrace.length + 1];
System.arraycopy(stackTrace, 0, redone, 1, stackTrace.length);
redone[0] = new StackTraceElement(getClass().getName(), groupName + "." + testName, source.getFileName().toString(), lineNumber);
redone[0] = new StackTraceElement(getClass().getName(), groupName + ".test" + testName, source.getFileName().toString(), lineNumber);
th.setStackTrace(redone);
return th;

View File

@ -71,8 +71,7 @@ public class SqlSpecIntegrationTest extends SpecBaseIntegrationTestCase {
throw reworkException(new AssertionError(errorMessage(ae), ae.getCause()));
}
} catch (Throwable th) {
//throw reworkException(new RuntimeException(errorMessage(th)));
throw th;
throw reworkException(th);
}
}