DUP-GO-4: ErrUnsupported fallback pattern duplicated in handleSessionChanges and handleSessionInfo #45
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
handleSessionChanges(lines 474–493) andhandleSessionInfo(lines 497–519) ininternal/server/handlers_sessions.goboth have the same two-tier error handling structure:errors.Is(err, platforms.ErrUnsupported)→ return zeroed-out responsewritePlatformErrorfor other errorsBoth also manually nil-guard nested slices on the returned struct before writing JSON. The pattern is ~15 lines each.
Fix
Extract a
withUnsupportedFallback[T](w, err, zero T)helper using generics.Effort
Trivial.