Refine error types thrown
[poolifier.git] / src / pools / abstract-pool.ts
index abbf7638c0b325fbd1534ec44a14eb5d6260d579..72e830745558831db7933dfcfd5b6c8a03b35d78 100644 (file)
@@ -39,9 +39,6 @@ export abstract class AbstractPool<
   /** @inheritDoc */
   public readonly emitter?: PoolEmitter
 
-  /** @inheritDoc */
-  public readonly max?: number
-
   /**
    * The promise map.
    *
@@ -129,11 +126,11 @@ export abstract class AbstractPool<
         'Cannot instantiate a pool without specifying the number of workers'
       )
     } else if (Number.isSafeInteger(numberOfWorkers) === false) {
-      throw new Error(
+      throw new TypeError(
         'Cannot instantiate a pool with a non integer number of workers'
       )
     } else if (numberOfWorkers < 0) {
-      throw new Error(
+      throw new RangeError(
         'Cannot instantiate a pool with a negative number of workers'
       )
     } else if (this.type === PoolType.FIXED && numberOfWorkers === 0) {