coopernurse / node-pool

Generic resource pooling for node.js
2.38k stars 259 forks source link

If factory.validate rejects it is not handled by the library #195

Open mdouglass opened 7 years ago

mdouglass commented 7 years ago

I know the API doesn't strictly allow this, but if the promise returned by factory.validate rejects (instead of resolving with true/false) the resulting resolve is unhandled (b/c of a missing .catch at lib/Pool.js:157) and results in a node.js warning.

(node:58052) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Combat is already completed
(node:58052) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Ideally, a reject from the validation logic would be treated the same as resolve(false).

Thanks!