Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit c5b4752

Browse files
committedMay 23, 2018
feat(MongoTimeoutError): add common class for timeout events
1 parent a7f653b commit c5b4752

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed
 

‎lib/error.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ util.inherits(MongoNetworkError, MongoError);
6666
* @class
6767
* @param {Error|string|object} message The error message
6868
* @property {string} message The error message
69-
* @return {MongoParseError} A MongoNetworkError instance
69+
* @return {MongoParseError} A MongoParseError instance
7070
* @extends {MongoError}
7171
*/
7272
const MongoParseError = function(message) {
@@ -75,8 +75,24 @@ const MongoParseError = function(message) {
7575
};
7676
util.inherits(MongoParseError, MongoError);
7777

78+
/**
79+
* An error signifying a timeout event
80+
*
81+
* @class
82+
* @param {Error|string|object} message The error message
83+
* @property {string} message The error message
84+
* @return {MongoTimeoutError} A MongoTimeoutError instance
85+
* @extends {MongoError}
86+
*/
87+
const MongoTimeoutError = function(message) {
88+
MongoError.call(this, message);
89+
this.name = 'MongoTimeoutError';
90+
};
91+
util.inherits(MongoTimeoutError, MongoError);
92+
7893
module.exports = {
79-
MongoError: MongoError,
80-
MongoNetworkError: MongoNetworkError,
81-
MongoParseError: MongoParseError
94+
MongoError,
95+
MongoNetworkError,
96+
MongoParseError,
97+
MongoTimeoutError
8298
};

0 commit comments

Comments
 (0)
This repository has been archived.