From d03a70632b89beaa18910aedf60cc95a7632399b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 28 Jul 2025 20:02:17 +0200 Subject: [PATCH] refactor: refine error messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 2 +- src/pools/utils.ts | 2 +- tests/pools/abstract-pool.test.mjs | 4 ++-- tests/pools/cluster/dynamic.test.mjs | 2 +- tests/pools/thread/dynamic.test.mjs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 22da4e00b..84ef7c6a1 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -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' ) } } diff --git a/src/pools/utils.ts b/src/pools/utils.ts index 93cb42070..5c5bbdef8 100644 --- a/src/pools/utils.ts +++ b/src/pools/utils.ts @@ -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') diff --git a/tests/pools/abstract-pool.test.mjs b/tests/pools/abstract-pool.test.mjs index 3c448b7e9..a65360ae9 100644 --- a/tests/pools/abstract-pool.test.mjs +++ b/tests/pools/abstract-pool.test.mjs @@ -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' ) ) }) diff --git a/tests/pools/cluster/dynamic.test.mjs b/tests/pools/cluster/dynamic.test.mjs index 6f0f611d8..3dfaee0b5 100644 --- a/tests/pools/cluster/dynamic.test.mjs +++ b/tests/pools/cluster/dynamic.test.mjs @@ -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' ) }) diff --git a/tests/pools/thread/dynamic.test.mjs b/tests/pools/thread/dynamic.test.mjs index d2f478609..c6e2de7ac 100644 --- a/tests/pools/thread/dynamic.test.mjs +++ b/tests/pools/thread/dynamic.test.mjs @@ -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' ) }) -- 2.53.0