Refactoring day1

This commit is contained in:
2020-08-20 20:27:14 +02:00
parent 6aceefeb2f
commit b907489a75
481 changed files with 5321 additions and 5616 deletions

View File

@@ -28,8 +28,7 @@ class MongooseServerSelectionError extends MongooseError {
// Special message for a case that is likely due to IP whitelisting issues.
const isAtlasWhitelistError = isAtlas(reason) &&
allServersUnknown(reason) &&
err.message.indexOf('bad auth') === -1 &&
err.message.indexOf('Authentication failed') === -1;
err.message.indexOf('bad auth') === -1;
this.message = isAtlasWhitelistError ?
atlasMessage :
err.message;

View File

@@ -4,9 +4,10 @@
'use strict';
const MongooseError = require('./mongooseError');
const MongooseError = require('./');
const util = require('util');
class ValidationError extends MongooseError {
/**
* Document Validation Error
@@ -107,4 +108,4 @@ function _generateMessage(err) {
* Module exports
*/
module.exports = ValidationError;
module.exports = exports = ValidationError;

View File

@@ -38,14 +38,6 @@ class ValidatorError extends MongooseError {
toString() {
return this.message;
}
/*!
* Ensure `name` and `message` show up in toJSON output re: gh-9296
*/
toJSON() {
return Object.assign({ name: this.name, message: this.message }, this);
}
}