refactor: refine error message at pool instantiation inside a worker
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 14 Aug 2023 14:39:51 +0000 (16:39 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 14 Aug 2023 14:39:51 +0000 (16:39 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts
tests/pools/abstract/abstract-pool.test.js

index 8332d31aefb2a9d91fac99bcea3a1d3690883be6..5633613ecebdda8cb763c7922588ebc504be4fc7 100644 (file)
@@ -106,7 +106,9 @@ export abstract class AbstractPool<
     protected readonly opts: PoolOptions<Worker>
   ) {
     if (!this.isMain()) {
-      throw new Error('Cannot start a pool from a worker!')
+      throw new Error(
+        'Cannot start a pool from the same worker type as the current pool one'
+      )
     }
     this.checkNumberOfWorkers(this.numberOfWorkers)
     this.checkFilePath(this.filePath)
index 953e50d07d09b43f1d36fb52317434b81e09152e..8652287769af1d63267dde6cc4873e1284fa15e2 100644 (file)
@@ -33,7 +33,9 @@ describe('Abstract pool test suite', () => {
             errorHandler: (e) => console.error(e)
           }
         )
-    ).toThrowError('Cannot start a pool from a worker!')
+    ).toThrowError(
+      'Cannot start a pool from the same worker type as the current pool one'
+    )
   })
 
   it('Verify that filePath is checked', () => {