catch exception for custom hour

This commit is contained in:
Girish Ramakrishnan
2021-01-13 17:09:45 -08:00
parent e15639583d
commit 8392642f5f

View File

@@ -60,9 +60,13 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
prettyDay = days.map(function (day) { return $scope.cronDays[parseInt(day, 10)].name.substr(0, 3); }).join(',');
}
var prettyHour = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)].name; }).join(',');
try {
var prettyHour = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)].name; }).join(',');
return prettyDay + ' at ' + prettyHour;
return prettyDay + ' at ' + prettyHour;
} catch (error) {
return 'Custom pattern';
}
};
$scope.update = {
@@ -254,7 +258,11 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
} else {
$scope.updateSchedule.days = days.map(function (day) { return $scope.cronDays[parseInt(day, 10)]; });
}
$scope.updateSchedule.hours = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)]; });
try {
$scope.updateSchedule.hours = hours.map(function (hour) { return $scope.cronHours[parseInt(hour, 10)]; });
} catch (e) {
console.error('Error parsing hour');
}
}
$('#updateScheduleModal').modal('show');