Skip to content

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

Description

@deannos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions