Skip to content

Commit c438bcf

Browse files
add poolcleared network error
1 parent 3157efb commit c438bcf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cmap/errors.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ export class PoolClearedError extends MongoNetworkError {
3939
}
4040
}
4141

42+
/**
43+
* An error indicating that a connection pool has been cleared after the monitor for that server timed out.
44+
* @category Error
45+
*/
46+
export class PoolClearedOnNetworkError extends MongoNetworkError {
47+
/** The address of the connection pool */
48+
address: string;
49+
constructor(pool: ConnectionPool) {
50+
super(`Connection to ${pool.address} interrupted due to server monitor timeout`);
51+
this.address = pool.address;
52+
}
53+
54+
override get name(): string {
55+
return 'PoolClearedOnNetworkError';
56+
}
57+
}
58+
4259
/**
4360
* An error thrown when a request to check out a connection times out
4461
* @category Error

0 commit comments

Comments
 (0)