refactor: cleanup error type
[poolifier.git] / src / pools / worker-node.ts
index 09e4a7b5cd8831360365a7a88e338e3b921eaf91..57628bf72c74c28d18764e8d6fed067f687e6e71 100644 (file)
@@ -41,18 +41,20 @@ implements IWorkerNode<Worker, Data> {
    */
   constructor (worker: Worker, workerType: WorkerType, poolMaxSize: number) {
     if (worker == null) {
-      throw new Error('Cannot construct a worker node without a worker')
+      throw new TypeError('Cannot construct a worker node without a worker')
     }
     if (workerType == null) {
-      throw new Error('Cannot construct a worker node without a worker type')
+      throw new TypeError(
+        'Cannot construct a worker node without a worker type'
+      )
     }
     if (poolMaxSize == null) {
-      throw new Error(
+      throw new TypeError(
         'Cannot construct a worker node without a pool maximum size'
       )
     }
     if (isNaN(poolMaxSize)) {
-      throw new Error(
+      throw new TypeError(
         'Cannot construct a worker node with a NaN pool maximum size'
       )
     }