MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / validatePoliciesOptions

Function validatePoliciesOptions

lib/client-options.js:202–222  ·  view source on GitHub ↗

* Validates the policies from the client options. * @param {ClientOptions.policies} policiesOptions * @private

(policiesOptions)

Source from the content-addressed store, hash-verified

200 * @private
201 */
202function validatePoliciesOptions(policiesOptions) {
203 if (!policiesOptions) {
204 throw new TypeError('policies not defined in options');
205 }
206 if (!(policiesOptions.loadBalancing instanceof policies.loadBalancing.LoadBalancingPolicy)) {
207 throw new TypeError('Load balancing policy must be an instance of LoadBalancingPolicy');
208 }
209 if (!(policiesOptions.reconnection instanceof policies.reconnection.ReconnectionPolicy)) {
210 throw new TypeError('Reconnection policy must be an instance of ReconnectionPolicy');
211 }
212 if (!(policiesOptions.retry instanceof policies.retry.RetryPolicy)) {
213 throw new TypeError('Retry policy must be an instance of RetryPolicy');
214 }
215 if (!(policiesOptions.addressResolution instanceof policies.addressResolution.AddressTranslator)) {
216 throw new TypeError('Address resolution policy must be an instance of AddressTranslator');
217 }
218 if (policiesOptions.timestampGeneration !== null &&
219 !(policiesOptions.timestampGeneration instanceof policies.timestampGeneration.TimestampGenerator)) {
220 throw new TypeError('Timestamp generation policy must be an instance of TimestampGenerator');
221 }
222}
223
224/**
225 * Validates the protocol options.

Callers 1

extendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected