29 lines
581 B
JavaScript
29 lines
581 B
JavaScript
/**
|
|
* MongooseError constructor
|
|
*
|
|
* @param {String} msg Error message
|
|
* @inherits Error https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
function MongooseError(msg) {
|
|
Error.call(this);
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this);
|
|
} else {
|
|
this.stack = new Error().stack;
|
|
}
|
|
this.message = msg;
|
|
this.name = 'MongooseError';
|
|
}
|
|
|
|
/*!
|
|
* Inherits from Error.
|
|
*/
|
|
|
|
MongooseError.prototype = Object.create(Error.prototype);
|
|
MongooseError.prototype.constructor = Error;
|
|
|
|
module.exports = MongooseError;
|