[cleanup] Replace string-matching error detection with typed errors #39

Closed
opened 2026-03-04 12:20:03 +01:00 by clawbot · 0 comments
Collaborator

From QA Audit (#25 comment)

Severity: SHOULD-FIX

strings.Contains(err.Error(), "UNIQUE") is used in internal/handlers/api.go and internal/handlers/auth.go to detect duplicate nick errors. Fragile if SQLite driver changes message format.

Suggested fix: Use errors.As with the SQLite driver's error type.

## From QA Audit ([#25 comment](https://git.eeqj.de/sneak/chat/issues/25#issuecomment-10914)) **Severity: SHOULD-FIX** `strings.Contains(err.Error(), "UNIQUE")` is used in `internal/handlers/api.go` and `internal/handlers/auth.go` to detect duplicate nick errors. Fragile if SQLite driver changes message format. **Suggested fix:** Use `errors.As` with the SQLite driver's error type.
sneak closed this issue 2026-03-10 11:54:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/chat#39