summaryrefslogtreecommitdiff
path: root/internal/handlers/widget.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-14 20:42:34 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-16 02:44:52 +0000
commit879e67a95cf994376cbb7e5724a7599c1711b1ec (patch)
treeade8c4d65674d486914c2865f2af733c499ae163 /internal/handlers/widget.go
parent146034b08446c4bf0099bb41ab5e689d418e6dce (diff)
fix(tasks): return ErrNativeTaskNotFound from UpdateNativeTask on stale id
HandleWidgetTaskUpdate now returns 404 instead of silently succeeding when the widget's cached task id no longer exists, matching every other native_tasks mutator's checkRowsAffected pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD
Diffstat (limited to 'internal/handlers/widget.go')
-rw-r--r--internal/handlers/widget.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/handlers/widget.go b/internal/handlers/widget.go
index 15ef3b2..b8c3aa9 100644
--- a/internal/handlers/widget.go
+++ b/internal/handlers/widget.go
@@ -473,6 +473,10 @@ func (h *Handler) HandleWidgetTaskUpdate(w http.ResponseWriter, r *http.Request)
return
}
if err := h.store.UpdateNativeTask(req.ID, req.Title, req.Description); err != nil {
+ if errors.Is(err, store.ErrNativeTaskNotFound) {
+ http.Error(w, "task not found", http.StatusNotFound)
+ return
+ }
http.Error(w, "failed to update task", http.StatusInternalServerError)
return
}