use of io.cucumber.core.backend.Located in project cucumber-jvm by cucumber.
the class StackManipulation method removeFrameworkFrames.
static Throwable removeFrameworkFrames(CucumberInvocationTargetException invocationException) {
Throwable error = invocationException.getInvocationTargetExceptionCause();
StackTraceElement[] stackTraceElements = error.getStackTrace();
Located located = invocationException.getLocated();
int newStackTraceLength = findIndexOf(located, stackTraceElements);
if (newStackTraceLength == -1) {
return error;
}
StackTraceElement[] newStackTrace = new StackTraceElement[newStackTraceLength];
System.arraycopy(stackTraceElements, 0, newStackTrace, 0, newStackTraceLength);
error.setStackTrace(newStackTrace);
return error;
}
use of io.cucumber.core.backend.Located in project cucumber-jvm by cucumber.
the class StackManipulation method removeFrameworkFramesAndAppendStepLocation.
static Throwable removeFrameworkFramesAndAppendStepLocation(CucumberInvocationTargetException invocationException, StackTraceElement stepLocation) {
Located located = invocationException.getLocated();
Throwable error = invocationException.getInvocationTargetExceptionCause();
if (stepLocation == null) {
return error;
}
StackTraceElement[] stackTraceElements = error.getStackTrace();
int newStackTraceLength = findIndexOf(located, stackTraceElements);
if (newStackTraceLength == -1) {
return error;
}
StackTraceElement[] newStackTrace = new StackTraceElement[newStackTraceLength + 1];
System.arraycopy(stackTraceElements, 0, newStackTrace, 0, newStackTraceLength);
newStackTrace[newStackTraceLength] = stepLocation;
error.setStackTrace(newStackTrace);
return error;
}
Aggregations