todoist-repeater

Create recurring tasks in Todoist with cron-style syntax
Log | Files | Refs | README

commit 41300522d52a0aba6895f671088822a8d326d152
parent 40e7a37d582f88267d9f884fd0f14a3e3bc1ca85
Author: David Schlachter <t480-debian-git@schlachter.ca>
Date:   Mon, 10 Nov 2025 00:24:57 -0500

Catch errors when adding tasks

Diffstat:
Mmain.go | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go @@ -169,7 +169,11 @@ func createTask(task string) { func addJobs(c *cron.Cron, tasks map[inputLine]struct{}) { for task := range tasks { - c.AddFunc(task.Schedule, func() { createTask(task.Task) }) - log.Printf("Added '%s' with recurrence '%s'", task.Task, task.Schedule) + _, err := c.AddFunc(task.Schedule, func() { createTask(task.Task) }) + if err != nil { + log.Printf("Failed to add '%s' with recurrence '%s': %s", task.Task, task.Schedule, err) + } else { + log.Printf("Added '%s' with recurrence '%s'", task.Task, task.Schedule) + } } }