(error, reason)
| 509 | var INVALID_URL = new PouchError(413, 'invalid_url', 'Provided URL is invalid'); |
| 510 | |
| 511 | function createError(error, reason) { |
| 512 | function CustomPouchError(reason) { |
| 513 | // inherit error properties from our parent error manually |
| 514 | // so as to allow proper JSON parsing. |
| 515 | var names = Object.getOwnPropertyNames(error); |
| 516 | for (var i = 0, len = names.length; i < len; i++) { |
| 517 | if (typeof error[names[i]] !== 'function') { |
| 518 | this[names[i]] = error[names[i]]; |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | if (this.stack === undefined) { |
| 523 | this.stack = (new Error()).stack; |
| 524 | } |
| 525 | |
| 526 | if (reason !== undefined) { |
| 527 | this.reason = reason; |
| 528 | } |
| 529 | } |
| 530 | CustomPouchError.prototype = PouchError.prototype; |
| 531 | return new CustomPouchError(reason); |
| 532 | } |
| 533 | |
| 534 | function generateErrorFromResponse(err) { |
| 535 |
no outgoing calls
no test coverage detected
searching dependent graphs…