From: Jérôme Benoit Date: Mon, 14 Aug 2023 14:39:51 +0000 (+0200) Subject: refactor: refine error message at pool instantiation inside a worker X-Git-Tag: v2.6.26~37 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=04f4516344e1c6968de6312bcafc8f7e2b3b0eeb;p=poolifier.git refactor: refine error message at pool instantiation inside a worker Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 8332d31a..5633613e 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -106,7 +106,9 @@ export abstract class AbstractPool< protected readonly opts: PoolOptions ) { 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) diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 953e50d0..86522877 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -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', () => {