refactor: warn when invalid cron entries might be written

This commit is contained in:
Jose Diaz-Gonzalez
2025-06-19 01:11:29 -04:00
parent 776013b0f4
commit ed851fe399
2 changed files with 3 additions and 2 deletions

View File

@@ -90,7 +90,7 @@ func FetchCronEntries(appName string) ([]TemplateCommand, error) {
parser := cronparser.NewParser(cronparser.Minute | cronparser.Hour | cronparser.Dom | cronparser.Month | cronparser.Dow | cronparser.Descriptor)
_, err := parser.Parse(c.Schedule)
if err != nil {
return commands, fmt.Errorf("Invalid cron schedule %s: %s", c.Schedule, err.Error())
return commands, fmt.Errorf("Invalid cron schedule for app %s (schedule %s): %s", appName, c.Schedule, err.Error())
}
commands = append(commands, TemplateCommand{

View File

@@ -55,7 +55,8 @@ func generateCronEntries() ([]cron.TemplateCommand, error) {
c, err := cron.FetchCronEntries(appName)
if err != nil {
results <- []cron.TemplateCommand{}
return err
common.LogWarn(err.Error())
return nil
}
results <- c