X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fabstract-pool.ts;h=192725082942b1aa7b8904c07eaf8a2731865f45;hb=984910dc4377061815ef8cb33a6dc91dfc35be3c;hp=687ae25f7f43154b484fafc27bb27ea7102b3961;hpb=21f710aa73abbb5d90328cfb199adfc0f7a70406;p=poolifier.git diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 687ae25f..19272508 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -158,18 +158,20 @@ export abstract class AbstractPool< } protected checkDynamicPoolSize (min: number, max: number): void { - if (this.type === PoolTypes.dynamic && min > max) { - throw new RangeError( - 'Cannot instantiate a dynamic pool with a maximum pool size inferior to the minimum pool size' - ) - } else if (this.type === PoolTypes.dynamic && min === 0 && max === 0) { - throw new RangeError( - 'Cannot instantiate a dynamic pool with a minimum pool size and a maximum pool size equal to zero' - ) - } else if (this.type === PoolTypes.dynamic && min === max) { - throw new RangeError( - 'Cannot instantiate a dynamic pool with a minimum pool size equal to the maximum pool size. Use a fixed pool instead' - ) + if (this.type === PoolTypes.dynamic) { + if (min > max) { + throw new RangeError( + 'Cannot instantiate a dynamic pool with a maximum pool size inferior to the minimum pool size' + ) + } else if (min === 0 && max === 0) { + throw new RangeError( + 'Cannot instantiate a dynamic pool with a minimum pool size and a maximum pool size equal to zero' + ) + } else if (min === max) { + throw new RangeError( + 'Cannot instantiate a dynamic pool with a minimum pool size equal to the maximum pool size. Use a fixed pool instead' + ) + } } }