Skip to content

Commit

Permalink
Add protection from adding jobs with empty names or
Browse files Browse the repository at this point in the history
worker functions.
  • Loading branch information
daku committed Mar 29, 2018
1 parent 6ed706c commit b26dc35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Models/Worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default class Worker {
*/
addWorker(jobName, worker, options = {}) {

if (!jobName || !worker) {
throw new Error('Job name and associated function must be supplied.');
}

// Attach options to worker
worker.options = {
concurrency: options.concurrency || 1
Expand Down

0 comments on commit b26dc35

Please sign in to comment.