use of co.cask.cdap.etl.common.BasicErrorRecord in project cdap by caskdata.
the class TransformEmitter method emitError.
@Override
public void emitError(InvalidEntry<Object> invalidEntry) {
if (shouldLogErrorWarning && errorConsumers.isEmpty() && errorOutputWriter == null) {
shouldLogErrorWarning = false;
LOG.warn("Stage {} emits error records, but has no error consumer. Error records will be dropped.", stageName);
return;
}
for (PipeTransformDetail pipeTransformDetail : errorConsumers.values()) {
ErrorRecord errorRecord = new BasicErrorRecord<>(invalidEntry.getInvalidRecord(), stageName, invalidEntry.getErrorCode(), invalidEntry.getErrorMsg());
pipeTransformDetail.process(new KeyValue<>(stageName, (Object) errorRecord));
}
try {
if (errorOutputWriter != null) {
errorOutputWriter.write(invalidEntry);
}
} catch (Exception e) {
Throwables.propagateIfPossible(e);
throw new RuntimeException(e);
}
}
Aggregations