From: Jérôme Benoit Date: Sat, 6 Jul 2024 21:08:12 +0000 (+0200) Subject: refactor: refine queue full error message X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9008a9668154357ce942ec56caa95dfc3fc08238;p=poolifier.git refactor: refine queue full error message Signed-off-by: Jérôme Benoit --- diff --git a/src/fixed-priority-queue.ts b/src/fixed-priority-queue.ts index 74d43c4b..1ce6bbc4 100644 --- a/src/fixed-priority-queue.ts +++ b/src/fixed-priority-queue.ts @@ -43,7 +43,7 @@ export class FixedPriorityQueue implements IFixedQueue { /** @inheritdoc */ public enqueue (data: T, priority?: number): number { if (this.full()) { - throw new Error('Priority queue is full') + throw new Error('Fixed priority queue is full') } priority = priority ?? 0 let inserted = false diff --git a/src/fixed-queue.ts b/src/fixed-queue.ts index 171cd578..985acf50 100644 --- a/src/fixed-queue.ts +++ b/src/fixed-queue.ts @@ -43,7 +43,7 @@ export class FixedQueue implements IFixedQueue { /** @inheritdoc */ public enqueue (data: T, priority?: number): number { if (this.full()) { - throw new Error('Priority queue is full') + throw new Error('Fixed queue is full') } let index = this.start + this.size if (index >= this.capacity) { diff --git a/tests/fixed-priority-queue.test.mjs b/tests/fixed-priority-queue.test.mjs index 9321709d..41212c46 100644 --- a/tests/fixed-priority-queue.test.mjs +++ b/tests/fixed-priority-queue.test.mjs @@ -72,7 +72,7 @@ describe('Fixed priority queue test suite', () => { ]) expect(fixedPriorityQueue.capacity).toBe(queueSize) expect(() => fixedPriorityQueue.enqueue(4)).toThrow( - new Error('Priority queue is full') + new Error('Fixed priority queue is full') ) }) diff --git a/tests/fixed-queue.test.mjs b/tests/fixed-queue.test.mjs index e99e7566..fc81e128 100644 --- a/tests/fixed-queue.test.mjs +++ b/tests/fixed-queue.test.mjs @@ -70,7 +70,7 @@ describe('Fixed queue test suite', () => { ]) expect(fixedQueue.capacity).toBe(queueSize) expect(() => fixedQueue.enqueue(4)).toThrow( - new Error('Priority queue is full') + new Error('Fixed queue is full') ) })