-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*! | ||
* Module dependencies. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const MongooseError = require('./'); | ||
|
||
|
||
/** | ||
* The connection failed to reconnect and will never successfully reconnect to | ||
* MongoDB without manual intervention. | ||
* @api private | ||
*/ | ||
class EachAsyncMultiError extends MongooseError { | ||
/** | ||
* @param {String} connectionString | ||
*/ | ||
constructor(errors) { | ||
let preview = errors.map(e => e.message).join(', '); | ||
if (preview.length > 50) { | ||
preview = preview.slice(0, 50) + '...'; | ||
} | ||
super(`eachAsync() finished with ${errors.length} errors: ${preview}`); | ||
|
||
this.errors = errors; | ||
} | ||
} | ||
|
||
Object.defineProperty(EachAsyncMultiError.prototype, 'name', { | ||
value: 'EachAsyncMultiError' | ||
}); | ||
|
||
/*! | ||
* exports | ||
*/ | ||
|
||
module.exports = EachAsyncMultiError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters