From 836d8e263448bacbce9dde806d69aaf81f2f67c6 Mon Sep 17 00:00:00 2001 From: Mehdi Hasan Date: Sat, 5 Oct 2019 14:34:22 +0600 Subject: [PATCH] Update queue name validation --- src/consumer.ts | 4 ++-- src/producer.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/consumer.ts b/src/consumer.ts index d5a4ff2..7a3b44c 100644 --- a/src/consumer.ts +++ b/src/consumer.ts @@ -47,8 +47,8 @@ export class Consumer { throw new Error('workerFn is required'); } - if (!qname) { - throw new Error('qname is required'); + if (!qname || qname === defaultOptions.INTERNALS) { + throw new Error(`qname cannot be empty or set as "${defaultOptions.INTERNALS}"`); } this.consumers = []; diff --git a/src/producer.ts b/src/producer.ts index 5e3b30f..9a0fad4 100644 --- a/src/producer.ts +++ b/src/producer.ts @@ -38,8 +38,8 @@ export class Producer { this._redis = new IORedis(this._redisOptions) as Redis; } - if (!qname) { - throw new Error('qname is required'); + if (!qname || qname === defaultOptions.INTERNALS) { + throw new Error(`qname cannot be empty or set as "${defaultOptions.INTERNALS}"`); } this._QNAME = `${defaultOptions.NAMESPACE}:queue:${qname}`;