* Schema validator error * * @param {Object} properties * @param {Document} doc * @api private
(properties, doc)
| 16 | * @api private |
| 17 | */ |
| 18 | constructor(properties, doc) { |
| 19 | let msg = properties.message; |
| 20 | if (!msg) { |
| 21 | msg = MongooseError.messages.general.default; |
| 22 | } |
| 23 | |
| 24 | const message = formatMessage(msg, properties, doc); |
| 25 | super(message); |
| 26 | |
| 27 | properties = Object.assign({}, properties, { message: message }); |
| 28 | this.properties = properties; |
| 29 | this.kind = properties.type; |
| 30 | this.path = properties.path; |
| 31 | this.value = properties.value; |
| 32 | this.reason = properties.reason; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * toString helper |
nothing calls this directly
no test coverage detected