Skip to content

Commit b26dc35

Browse files
committed
Add protection from adding jobs with empty names or
worker functions.
1 parent 6ed706c commit b26dc35

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Models/Worker.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default class Worker {
3434
*/
3535
addWorker(jobName, worker, options = {}) {
3636

37+
if (!jobName || !worker) {
38+
throw new Error('Job name and associated function must be supplied.');
39+
}
40+
3741
// Attach options to worker
3842
worker.options = {
3943
concurrency: options.concurrency || 1

0 commit comments

Comments
 (0)