Description
handlers/user_handler.go maps every error from users.Create to HTTP 409 with the message "username already taken". A transient DB error, constraint issue on another column, or any other failure produces a misleading response.
Location
handlers/user_handler.go:58–60
Fix
Inspect the error string for a UNIQUE constraint violation (e.g. strings.Contains(err.Error(), "UNIQUE")) and return 500 for everything else.
Description
handlers/user_handler.gomaps every error fromusers.Createto HTTP 409 with the message "username already taken". A transient DB error, constraint issue on another column, or any other failure produces a misleading response.Location
handlers/user_handler.go:58–60Fix
Inspect the error string for a UNIQUE constraint violation (e.g.
strings.Contains(err.Error(), "UNIQUE")) and return 500 for everything else.