* OverwriteModel Error constructor. * @api private
(filter, model, numAffected, result)
| 13 | * @api private |
| 14 | */ |
| 15 | constructor(filter, model, numAffected, result) { |
| 16 | let msg; |
| 17 | const messages = MongooseError.messages; |
| 18 | if (messages.DocumentNotFoundError != null) { |
| 19 | msg = typeof messages.DocumentNotFoundError === 'function' ? |
| 20 | messages.DocumentNotFoundError(filter, model) : |
| 21 | messages.DocumentNotFoundError; |
| 22 | } else { |
| 23 | msg = 'No document found for query "' + util.inspect(filter) + |
| 24 | '" on model "' + model + '"'; |
| 25 | } |
| 26 | |
| 27 | super(msg); |
| 28 | |
| 29 | this.result = result; |
| 30 | this.numAffected = numAffected; |
| 31 | this.filter = filter; |
| 32 | // Backwards compat |
| 33 | this.query = filter; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | Object.defineProperty(DocumentNotFoundError.prototype, 'name', { |