(message, code, extras)
| 10 | }; |
| 11 | |
| 12 | function ORMError(message, code, extras) { |
| 13 | Error.call(this); |
| 14 | Error.captureStackTrace(this, this.constructor); |
| 15 | |
| 16 | this.message = message; |
| 17 | if (code) { |
| 18 | this.code = codes[code]; |
| 19 | this.literalCode = code; |
| 20 | if (!this.code) { |
| 21 | throw new Error("Invalid error code: " + code); |
| 22 | } |
| 23 | } |
| 24 | if (extras) { |
| 25 | for(var k in extras) { |
| 26 | this[k] = extras[k]; |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | ORMError.prototype = Object.create(Error.prototype); |
| 32 | ORMError.prototype.constructor = ORMError; |