coopernurse / node-pool

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

Support .use() with sync functions / sync throws #297

Open joelrbrandt opened 2 years ago

joelrbrandt commented 2 years ago

Fixes #296

Modifies .use() to check whether the result returned from the work function isn then-able. If it is not then-able (or if it throws a synchronous exception), wraps the result in a resolved/rejected Promise.