use of org.apache.flink.runtime.operators.chaining.ExceptionInChainedStubException in project flink by apache.
the class NoOpChainedDriver method collect.
@Override
public void collect(IT record) {
try {
this.numRecordsIn.inc();
this.outputCollector.collect(record);
} catch (Exception ex) {
throw new ExceptionInChainedStubException(this.taskName, ex);
}
}
use of org.apache.flink.runtime.operators.chaining.ExceptionInChainedStubException in project flink by apache.
the class BatchTask method logAndThrowException.
/**
* Prints an error message and throws the given exception. If the exception is of the type
* {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed
* until an exception of a different type is found.
*
* @param ex The exception to be thrown.
* @param parent The parent task, whose information is included in the log message.
* @throws Exception Always thrown.
*/
public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception {
String taskName;
if (ex instanceof ExceptionInChainedStubException) {
do {
ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex;
taskName = cex.getTaskName();
ex = cex.getWrappedException();
} while (ex instanceof ExceptionInChainedStubException);
} else {
taskName = parent.getEnvironment().getTaskInfo().getTaskName();
}
if (LOG.isErrorEnabled()) {
LOG.error(constructLogString("Error in task code", taskName, parent), ex);
}
throw ex;
}
Aggregations