(error, reason)
| 497 | var INVALID_URL = new PouchError(413, 'invalid_url', 'Provided URL is invalid'); |
| 498 | |
| 499 | function createError(error, reason) { |
| 500 | function CustomPouchError(reason) { |
| 501 | // inherit error properties from our parent error manually |
| 502 | // so as to allow proper JSON parsing. |
| 503 | var names = Object.getOwnPropertyNames(error); |
| 504 | for (var i = 0, len = names.length; i < len; i++) { |
| 505 | if (typeof error[names[i]] !== 'function') { |
| 506 | this[names[i]] = error[names[i]]; |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | if (this.stack === undefined) { |
| 511 | this.stack = (new Error()).stack; |
| 512 | } |
| 513 | |
| 514 | if (reason !== undefined) { |
| 515 | this.reason = reason; |
| 516 | } |
| 517 | } |
| 518 | CustomPouchError.prototype = PouchError.prototype; |
| 519 | return new CustomPouchError(reason); |
| 520 | } |
| 521 | |
| 522 | function generateErrorFromResponse(err) { |
| 523 |
no outgoing calls
no test coverage detected
searching dependent graphs…