Commit
This commit is contained in:
commit
d1c8cae2c1
1417 changed files with 326736 additions and 0 deletions
41
node_modules/mongoose/lib/error/eachAsyncMultiError.js
generated
vendored
Normal file
41
node_modules/mongoose/lib/error/eachAsyncMultiError.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*!
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const MongooseError = require('./mongooseError');
|
||||
|
||||
|
||||
/**
|
||||
* If `eachAsync()` is called with `continueOnError: true`, there can be
|
||||
* multiple errors. This error class contains an `errors` property, which
|
||||
* contains an array of all errors that occurred in `eachAsync()`.
|
||||
*
|
||||
* @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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue