]> Piment Noir Git Repositories - poolifier.git/commitdiff
refactor: refine error messages
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 28 Jul 2025 18:02:17 +0000 (20:02 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 28 Jul 2025 18:02:17 +0000 (20:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts
src/pools/utils.ts
tests/pools/abstract-pool.test.mjs
tests/pools/cluster/dynamic.test.mjs
tests/pools/thread/dynamic.test.mjs

index 22da4e00b0fce07966a73d43c40ba41af4ce2700..84ef7c6a1281fff9d0ab4948c9f43e51b9bab87d 100644 (file)
@@ -1548,7 +1548,7 @@ export abstract class AbstractPool<
   private checkPoolType (): void {
     if (this.type === PoolTypes.fixed && this.maximumNumberOfWorkers != null) {
       throw new Error(
-        'Cannot instantiate a fixed pool with a maximum number of workers specified at initialization'
+        'Cannot instantiate a fixed pool with a maximum number of workers defined at initialization'
       )
     }
   }
index 93cb4207053aea154c7f67e4f3138bb698e82c3b..5c5bbdef85fc8c098351d06b6a1aa7cdd8152a17 100644 (file)
@@ -53,7 +53,7 @@ export const getDefaultTasksQueueOptions = (
 
 export const checkFilePath = (filePath: string | undefined): void => {
   if (filePath == null) {
-    throw new TypeError('The worker file path must be specified')
+    throw new TypeError('The worker file path must be defined')
   }
   if (typeof filePath !== 'string') {
     throw new TypeError('The worker file path must be a string')
index 3c448b7e90f49176240696c6b68560b183465356..a65360ae921e06eb08535eb8b13ab65280dd396f 100644 (file)
@@ -79,7 +79,7 @@ describe('Abstract pool test suite', () => {
 
   it('Verify that filePath is checked', () => {
     expect(() => new FixedThreadPool(numberOfWorkers)).toThrow(
-      new TypeError('The worker file path must be specified')
+      new TypeError('The worker file path must be defined')
     )
     expect(() => new FixedThreadPool(numberOfWorkers, 0)).toThrow(
       new TypeError('The worker file path must be a string')
@@ -136,7 +136,7 @@ describe('Abstract pool test suite', () => {
         )
     ).toThrow(
       new Error(
-        'Cannot instantiate a fixed pool with a maximum number of workers specified at initialization'
+        'Cannot instantiate a fixed pool with a maximum number of workers defined at initialization'
       )
     )
   })
index 6f0f611d8f807ca90c903c10592c6f817decdddc..3dfaee0b576a99ecd41d733c084e88f130244af2 100644 (file)
@@ -103,7 +103,7 @@ describe('Dynamic cluster pool test suite', () => {
 
   it('Validation of inputs test', () => {
     expect(() => new DynamicClusterPool(min)).toThrow(
-      'The worker file path must be specified'
+      'The worker file path must be defined'
     )
   })
 
index d2f478609f6495803e26cb5f4d0423289b82122c..c6e2de7ac102f7e9d26eb425d1d7ae1dcbb7c137 100644 (file)
@@ -103,7 +103,7 @@ describe('Dynamic thread pool test suite', () => {
 
   it('Validation of inputs test', () => {
     expect(() => new DynamicThreadPool(min)).toThrow(
-      'The worker file path must be specified'
+      'The worker file path must be defined'
     )
   })