-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
Functions like MarkTaskDone, MarkTaskInProgress print errors directly instead of returning them.
func MarkTaskDone(cfg config.Config, taskTitle string) { // ← Returns void
// ...
if foundTask == nil {
fmt.Printf("Task '%s' not found.\n", taskTitle) // Prints directly
return
}
// ...
}Problem
- Caller cannot tell if operation succeeded
- Error messages go to stdout, not stderr
- Caller cannot make decisions based on success/failure
- Inconsistent with Go error handling patterns
Solution
Change signatures to return error:
func MarkTaskDone(cfg config.Config, taskTitle string) error {
// ...
if foundTask == nil {
return fmt.Errorf("task not found: %s", taskTitle)
}
// ...
return nil
}Update all callers to check errors.
Affected Functions
MarkTaskDoneMarkTaskInProgressMarkTaskInProgressByTitle
Benefits
- Proper Go error handling
- Caller has control over error messages
- Enables better error handling in CLI
Impact
🟡 Medium - Requires caller updates
Metadata
Metadata
Assignees
Labels
No labels