gx
chenyc
2025-06-12 7b72ac13a83764a662159d4a49b7fffb90476ecb
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
'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
};