bug: CreateUser returns 409 Conflict for any database error, not just unique violations

Open Beginner friendly
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
api, backend

Research direction

Read handlers/user_handler.go:58–60 and inspect the error returned by users.Create. Done means UNIQUE constraint violations retain the 409 response and “username already taken” message, while transient database errors, other constraint failures, and other errors return 500.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deannos/notifyQ

All issues in deannos/notifyQ

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.