public void afterChunkError(ChunkContext context) {
if(context != null) {
try {
delegate.onError((Exception) context.getAttribute(ChunkListener.ROLLBACK_EXCEPTION_KEY));
} catch (Exception e) {
throw new UncheckedTransactionException(e);
}
} else {
throw new BatchRuntimeException("Unable to retrieve causing exception due to null ChunkContext");
}
}