You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
912 B

2 months ago
'use strict';
const MongoError = require('../core/error').MongoError;
/**
* An error indicating a connection pool is closed
*
* @property {string} address The address of the connection pool
* @extends MongoError
*/
class PoolClosedError extends MongoError {
constructor(pool) {
super('Attempted to check out a connection from closed connection pool');
this.name = 'MongoPoolClosedError';
this.address = pool.address;
}
}
/**
* An error thrown when a request to check out a connection times out
*
* @property {string} address The address of the connection pool
* @extends MongoError
*/
class WaitQueueTimeoutError extends MongoError {
constructor(pool) {
super('Timed out while checking out a connection from connection pool');
this.name = 'MongoWaitQueueTimeoutError';
this.address = pool.address;
}
}
module.exports = {
PoolClosedError,
WaitQueueTimeoutError
};