jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcMultiRowRecordWriter.java
private void handleSqlException(
    SQLException exception,
    List<Record> inputRecords,
    List<OnRecordErrorException> errors
  ) throws StageException {
    if(jdbcUtil.isDataError(getCustomDataSqlStateCodes(), getConnectionString(), exception)) {
      String formattedError = jdbcUtil.formatSqlException(exception);
      LOG.error(JdbcErrors.JDBC_89.getMessage(), formattedError);

      for(Record inputRecord : inputRecords) {
        errors.add(new OnRecordErrorException(inputRecord, JdbcErrors.JDBC_89, formattedError));
      }
      return;
    }

    super.handleSqlException(exception);
  }
private void handleSqlException(
    SQLException exception,
    List<Record> inputRecords,
    List<OnRecordErrorException> errors
  ) throws StageException {
    if(jdbcUtil.isDataError(getCustomDataSqlStateCodes(), getConnectionString(), exception)) {
      String formattedError = jdbcUtil.formatSqlException(exception);
      LOG.error(JdbcErrors.JDBC_89.getMessage(), formattedError);

      for(Record inputRecord : inputRecords) {
        errors.add(new OnRecordErrorException(inputRecord, JdbcErrors.JDBC_89, formattedError));
      }
      return;
    }

    super.handleSqlException(exception);
  }
Handle SQLException in a smart way, detecting if the exception is data oriented or not.