Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 };
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 };
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);
};
_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);
}
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;
}
}
_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);
}
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);
};
_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);
}