diff --git a/source/priority-queue.ts b/source/priority-queue.ts index 86d1baf..9fa824d 100644 --- a/source/priority-queue.ts +++ b/source/priority-queue.ts @@ -35,13 +35,13 @@ export default class PriorityQueue implements Queue) => element.id === id); - if (existingIndex === -1) { + if (existingIndex === -1 ) { throw new Error('Invalid Index - No promise function of specified id available in the queue.'); } const [item] = this.#queue.splice(existingIndex, 1); if (item === undefined) { - return; + throw new Error('Undefined Item - No promise function of specified id available in the queue.'); } item.priority = priority;