catch exception for custom hour
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user