Skip to content

Commit

Permalink
Throw error if queue name is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
mugli committed Oct 5, 2019
1 parent f85dccb commit d72d95c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class Consumer {
throw new Error('workerFn is required');
}

if (!qname) {
throw new Error('qname is required');
}

this.consumers = [];
for (let i = 0; i < this.concurrency; i++) {
const consumer = new ConsumerUnit(qname, workerFn, options);
Expand Down
4 changes: 4 additions & 0 deletions src/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class Producer {
this._redis = new IORedis(this._redisOptions) as Redis;
}

if (!qname) {
throw new Error('qname is required');
}

this._QNAME = `${defaultOptions.NAMESPACE}:queue:${qname}`;
this._DEDUPSET = `${defaultOptions.NAMESPACE}:queue:${qname}:dedupset`;

Expand Down

0 comments on commit d72d95c

Please sign in to comment.