feat: improve events emission
[poolifier.git] / src / pools / pool.ts
index 89559d2c9a1bf0e6694709d3908a0263af0c448e..32adfc66ab7a7b7cd4e6dc95e7e8d9346592773c 100644 (file)
@@ -40,7 +40,8 @@ export class PoolEmitter extends EventEmitterAsyncResource {}
 export const PoolEvents = Object.freeze({
   full: 'full',
   busy: 'busy',
-  error: 'error'
+  error: 'error',
+  taskError: 'taskError'
 } as const)
 
 /**
@@ -147,7 +148,8 @@ export interface IPool<
    *
    * - `'full'`: Emitted when the pool is dynamic and full.
    * - `'busy'`: Emitted when the pool is busy.
-   * - `'error'`: Emitted when an error occurs.
+   * - `'error'`: Emitted when an uncaught error occurs.
+   * - `'taskError'`: Emitted when an error occurs while executing a task.
    */
   readonly emitter?: PoolEmitter
   /**