8000 Merge pull request #154 from nel215/feature/throw_error_instance_in_s… · github4f/node-cron@394c367 · GitHub
[go: up one dir, main page]

Skip to content

Commit 394c367

Browse files
committed
Merge pull request kelektiv#154 from nel215/feature/throw_error_instance_in_set_time
Modified CronJob.prototype.setTime to throw error instance
2 parents 8b1181c + 068ffce commit 394c367

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/cron.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ var addCallback = function(callback) {
375375
CronJob.prototype.addCallback = addCallback;
376376

377377
CronJob.prototype.setTime = function(time) {
378-
if (!(time instanceof CronTime)) throw '\'time\' must be an instance of CronTime.';
378+
if (!(time instanceof CronTime)) throw new Error('\'time\' must be an instance of CronTime.');
379379
this.stop();
380380
this.cronTime = time;
381381
}

tests/test-cron.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ module.exports = testCase({
365365
job.stop();
366366
assert.throws(function() {
367367
job.setTime(time);
368-
});
368+
}, Error, '\'time\' must be an instance of CronTime.');
369369

370370
clock.restore();
371371
job.stop();

0 commit comments

Comments
 (0)
0