Skip to content

Commit

Permalink
Try to catch errors from cron library related to kelektiv/node-cron#467
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2th committed Jun 9, 2023
1 parent f3d3218 commit c15f812
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/scheduler/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,13 @@ module.exports = class SchedulerDevice extends Device {
*/
async schedulerEnable() {
this.log(`${this.getName()} - schedulerEnable`);
this.cronJob.start();
await this.setCapabilityValue('is_enabled', true);
try {
this.cronJob.start();
await this.setCapabilityValue('is_enabled', true);
} catch (error) {
await this.setCapabilityValue('is_enabled', false);
this.error(`${this.getName()} - schedulerEnable - error: ${error}`);
}
this.updateScheduleCapabilityValues();
}

Expand Down

0 comments on commit c15f812

Please sign in to comment.