public static void conditionFailedWithException(@Nullable ErrorCollector errorCollector, @Nullable ValueRecorder recorder, @Nullable String text, int line, int column, @Nullable Object message, Throwable throwable){
if (throwable instanceof SpockAssertionError) {
final SpockAssertionError spockAssertionError = (SpockAssertionError) throwable;
errorCollector.collectOrThrow(spockAssertionError);
return;
}
if (throwable instanceof SpockException) {
final SpockException spockException = (SpockException) throwable;
errorCollector.collectOrThrow(spockException);
return;
}
final ConditionFailedWithExceptionError conditionNotSatisfiedError = new ConditionFailedWithExceptionError(
new Condition(
getValues(recorder),
text,
TextPosition.create(line, column),
messageToString(message),
recorder == null ? null : recorder.getCurrentRecordingVarNum(),
recorder == null ? null : throwable),
throwable);
errorCollector.collectOrThrow(conditionNotSatisfiedError);
}