Search in sources :

Example 1 with BasicErrorRecord

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);
    }
}
Also used : PipeTransformDetail(co.cask.cdap.etl.batch.PipeTransformDetail) BasicErrorRecord(co.cask.cdap.etl.common.BasicErrorRecord) ErrorRecord(co.cask.cdap.etl.api.ErrorRecord) BasicErrorRecord(co.cask.cdap.etl.common.BasicErrorRecord)

Aggregations

ErrorRecord (co.cask.cdap.etl.api.ErrorRecord)1 PipeTransformDetail (co.cask.cdap.etl.batch.PipeTransformDetail)1 BasicErrorRecord (co.cask.cdap.etl.common.BasicErrorRecord)1