How to use the cassandra-driver.errors function in cassandra-driver

To help you get started, we’ve selected a few cassandra-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github godaddy / node-priam / test / unit / driver.execution.tests.js View on Github external
pool.stream = sinon.spy(async function *() {
        callCount++;
        if (callCount === 1) {
          throw new cql.errors.ResponseError(0x1200, 'timeout on read');
        } else {
          yield* data;
        }
      });
      instance.pools = { myKeySpace: pool };
github godaddy / node-priam / test / unit / driver.execution.tests.js View on Github external
pool.stream = sinon.spy(async function *() {
          callCount++;
          if (callCount === 1) {
            throw new cql.errors[errorName](errorCode, 'error message');
          } else {
            yield* data;
          }
        });
        instance.pools = { myKeySpace: pool };
github godaddy / node-priam / lib / drivers / datastax / driver.js View on Github external
DatastaxDriver.prototype.canRetryError = function canRetryError(err) {
  if (err instanceof cqlDriver.errors.ResponseError) {
    return retryableResponseErrors.indexOf(err.code) !== -1;
  }

  return (err instanceof cqlDriver.errors.NoHostAvailableError ||
  err instanceof cqlDriver.errors.DriverInternalError);
};
github godaddy / node-priam / lib / driver.js View on Github external
_canRetryError(err) {
    if (err instanceof cqlDriver.errors.ResponseError) {
      return retryableResponseErrors.indexOf(err.code) !== -1;
    }

    return (err instanceof cqlDriver.errors.NoHostAvailableError ||
    err instanceof cqlDriver.errors.DriverInternalError);
  }
github godaddy / node-priam / lib / driver.js View on Github external
async *_iterateCqlOnDriver(pool, cqlStatement, params, consistency, options) {
    const opts = this._prepareQueryArgs(cqlStatement, params, consistency, options);
    const execOptions = opts.execOptions;
    cqlStatement = opts.cqlStatement;
    params = opts.params;
    try {
      for await (const row of pool.stream(cqlStatement, params, execOptions)) {
        yield this._transformRecord(row, execOptions);
      }
    } catch (err) {
      if (err instanceof cqlDriver.errors.ResponseError) {
        err.type = findResponseErrorType(err.code);
      }
      err.query = {
        cql: cqlStatement,
        params,
        options: execOptions
      };
      throw err;
    }
  }
github godaddy / node-priam / lib / driver.js View on Github external
_canRetryError(err) {
    if (err instanceof cqlDriver.errors.ResponseError) {
      return retryableResponseErrors.indexOf(err.code) !== -1;
    }

    return (err instanceof cqlDriver.errors.NoHostAvailableError ||
    err instanceof cqlDriver.errors.DriverInternalError);
  }
github godaddy / node-priam / lib / drivers / datastax / driver.js View on Github external
DatastaxDriver.prototype.canRetryError = function canRetryError(err) {
  if (err instanceof cqlDriver.errors.ResponseError) {
    return retryableResponseErrors.indexOf(err.code) !== -1;
  }

  return (err instanceof cqlDriver.errors.NoHostAvailableError ||
  err instanceof cqlDriver.errors.DriverInternalError);
};
github godaddy / node-priam / lib / driver.js View on Github external
_canRetryError(err) {
    if (err instanceof cqlDriver.errors.ResponseError) {
      return retryableResponseErrors.indexOf(err.code) !== -1;
    }

    return (err instanceof cqlDriver.errors.NoHostAvailableError ||
    err instanceof cqlDriver.errors.DriverInternalError);
  }