All files / packages/core/src errors.ts

100% Statements 20/20
100% Branches 1/1
100% Functions 10/10
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70    4174x 4174x           2087x 2087x           2087x 2087x           6261x 6261x           2086x 2086x           2086x 2086x           2086x 2086x           3x 3x           68x 68x           6x 6x      
export class DriverCSError extends Error {
	constructor(msg: string) {
		super(`Invalid connection string. ${msg}`)
		this.name = 'DriverCSError'
	}
}
 
export class DriverCSProtocolError extends DriverCSError {
	constructor() {
		super('Protocol must be one of grpc, grpcs, http, https.')
		this.name = 'DriverCSProtocolError'
	}
}
 
export class DriverCSDatabaseError extends DriverCSError {
	constructor() {
		super('Database name is required in pathname or querystring.')
		this.name = 'DriverCSDatabaseError'
	}
}
 
export class DriverOptionsError extends Error {
	constructor(msg: string) {
		super(`Invalid driver options. ${msg}`)
		this.name = 'DriverOptionsError'
	}
}
 
export class DriverDiscoveryTimeoutError extends DriverOptionsError {
	constructor(actual: number) {
		super(`discovery_timeout_ms must be greater than 0. Received: ${actual}`)
		this.name = 'DriverDiscoveryTimeoutError'
	}
}
 
export class DriverDiscoveryIntervalError extends DriverOptionsError {
	constructor(actual: number) {
		super(`discovery_interval_ms must be greater than 0. Received: ${actual}`)
		this.name = 'DriverDiscoveryIntervalError'
	}
}
 
export class DriverDiscoveryOptionsError extends DriverOptionsError {
	constructor() {
		super(`discovery_interval_ms must be greater than discovery_timeout_ms.`)
		this.name = 'DriverDiscoveryOptionsError'
	}
}
 
export class DriverDegradedThresholdError extends DriverOptionsError {
	constructor(actual: number) {
		super(`discovery_degraded_threshold must be in the range (0, 1]. Received: ${actual}`)
		this.name = 'DriverDegradedThresholdError'
	}
}
 
export class DriverResponseError extends Error {
	constructor(msg: string) {
		super(`Invalid response. ${msg}`)
		this.name = 'DriverResponseError'
	}
}
 
export class EndpointsUnavailableError extends Error {
	constructor(msg = 'No endpoint available') {
		super(msg)
		this.name = 'EndpointsUnavailableError'
	}
}