(instances, cb, promise)
| 4546 | var errorObj = util.errorObj; |
| 4547 | |
| 4548 | function catchFilter(instances, cb, promise) { |
| 4549 | return function(e) { |
| 4550 | var boundTo = promise._boundValue(); |
| 4551 | predicateLoop: for (var i = 0; i < instances.length; ++i) { |
| 4552 | var item = instances[i]; |
| 4553 | |
| 4554 | if (item === Error || |
| 4555 | (item != null && item.prototype instanceof Error)) { |
| 4556 | if (e instanceof item) { |
| 4557 | return tryCatch(cb).call(boundTo, e); |
| 4558 | } |
| 4559 | } else if (typeof item === "function") { |
| 4560 | var matchesPredicate = tryCatch(item).call(boundTo, e); |
| 4561 | if (matchesPredicate === errorObj) { |
| 4562 | return matchesPredicate; |
| 4563 | } else if (matchesPredicate) { |
| 4564 | return tryCatch(cb).call(boundTo, e); |
| 4565 | } |
| 4566 | } else if (util.isObject(e)) { |
| 4567 | var keys = getKeys(item); |
| 4568 | for (var j = 0; j < keys.length; ++j) { |
| 4569 | var key = keys[j]; |
| 4570 | if (item[key] != e[key]) { |
| 4571 | continue predicateLoop; |
| 4572 | } |
| 4573 | } |
| 4574 | return tryCatch(cb).call(boundTo, e); |
| 4575 | } |
| 4576 | } |
| 4577 | return NEXT_FILTER; |
| 4578 | }; |
| 4579 | } |
| 4580 | |
| 4581 | return catchFilter; |
| 4582 | }; |
no test coverage detected