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