Refine error types thrown
[poolifier.git] / src / pools / abstract-pool.ts
index c9b8c795737a85338686df733c39397c39595201..72e830745558831db7933dfcfd5b6c8a03b35d78 100644 (file)
@@ -126,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) {