PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/mongoose/lib/error/index.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 116 lines | 23 code | 25 blank | 68 comment | 2 complexity | f232a83f26e6c2348faca71ce6be012d MD5 | raw file
  1
  2/**
  3 * MongooseError constructor
  4 *
  5 * @param {String} msg Error message
  6 * @inherits Error https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error
  7 */
  8
  9function MongooseError(msg) {
 10  Error.call(this);
 11  if (Error.captureStackTrace) {
 12    Error.captureStackTrace(this);
 13  } else {
 14    this.stack = new Error().stack;
 15  }
 16  this.message = msg;
 17  this.name = 'MongooseError';
 18}
 19
 20/*!
 21 * Inherits from Error.
 22 */
 23
 24MongooseError.prototype = Object.create(Error.prototype);
 25MongooseError.prototype.constructor = Error;
 26
 27/*!
 28 * Module exports.
 29 */
 30
 31module.exports = exports = MongooseError;
 32
 33/**
 34 * The default built-in validator error messages.
 35 *
 36 * @see Error.messages #error_messages_MongooseError-messages
 37 * @api public
 38 */
 39
 40MongooseError.messages = require('./messages');
 41
 42// backward compat
 43MongooseError.Messages = MongooseError.messages;
 44
 45/**
 46 * An instance of this error class will be returned when `save()` fails
 47 * because the underlying
 48 * document was not found. The constructor takes one parameter, the
 49 * conditions that mongoose passed to `update()` when trying to update
 50 * the document.
 51 *
 52 * @api public
 53 */
 54
 55MongooseError.DocumentNotFoundError = require('./notFound');
 56
 57/**
 58 * An instance of this error class will be returned when mongoose failed to
 59 * cast a value.
 60 *
 61 * @api public
 62 */
 63
 64MongooseError.CastError = require('./cast');
 65
 66/**
 67 * An instance of this error class will be returned when [validation](/docs/validation.html) failed.
 68 *
 69 * @api public
 70 */
 71
 72MongooseError.ValidationError = require('./validation');
 73
 74/**
 75 * A `ValidationError` has a hash of `errors` that contain individual `ValidatorError` instances
 76 *
 77 * @api public
 78 */
 79
 80MongooseError.ValidatorError = require('./validator');
 81
 82/**
 83 * An instance of this error class will be returned when you call `save()` after
 84 * the document in the database was changed in a potentially unsafe way. See
 85 * the [`versionKey` option](/docs/guide.html#versionKey) for more information.
 86 *
 87 * @api public
 88 */
 89
 90MongooseError.VersionError = require('./version');
 91
 92/**
 93 * Thrown when a model with the given name was already registered on the connection.
 94 * See [the FAQ about `OverwriteModelError`](/docs/faq.html#overwrite-model-error).
 95 *
 96 * @api public
 97 */
 98
 99MongooseError.OverwriteModelError = require('./overwriteModel');
100
101/**
102 * Thrown when you try to access a model that has not been registered yet
103 *
104 * @api public
105 */
106
107MongooseError.MissingSchemaError = require('./missingSchema');
108
109/**
110 * An instance of this error will be returned if you used an array projection
111 * and then modified the array in an unsafe way.
112 *
113 * @api public
114 */
115
116MongooseError.DivergentArrayError = require('./divergentArray');