chore: generate documentation
[poolifier.git] / src / pools / abstract-pool.ts
index 06e69a6e3140da3092e75a6ff7040e201c70255c..6d71e87e34378abe5c75ad1c1806eacaad979a3b 100644 (file)
@@ -510,7 +510,9 @@ export abstract class AbstractPool<
    * @throws {@link https://nodejs.org/api/errors.html#class-error} If the worker id is invalid.
    */
   private checkMessageWorkerId (message: MessageValue<Response>): void {
-    if (
+    if (message.workerId == null) {
+      throw new Error('Worker message received without worker id')
+    } else if (
       message.workerId != null &&
       this.getWorkerNodeKeyByWorkerId(message.workerId) === -1
     ) {
@@ -1123,6 +1125,9 @@ export abstract class AbstractPool<
   }
 
   private handleWorkerReadyResponse (message: MessageValue<Response>): void {
+    if (message.ready === false) {
+      throw new Error(`Worker ${message.workerId} failed to initialize`)
+    }
     this.getWorkerInfo(
       this.getWorkerNodeKeyByWorkerId(message.workerId)
     ).ready = message.ready as boolean