Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique constraint error while registering user with existing data #263

Open
arifszn opened this issue Jun 27, 2022 · 0 comments
Open

Unique constraint error while registering user with existing data #263

arifszn opened this issue Jun 27, 2022 · 0 comments

Comments

@arifszn
Copy link

arifszn commented Jun 27, 2022

If a user with username x or email [email protected] is already registered, while registering with the same input, it throws 500 internal server error.

{
    "error": {
        "statusCode": 500,
        "message": "ER_DUP_ENTRY: Duplicate entry 'x' for key 'users.username'",
        "errorName": "QueryFailedError",
        "path": "/api/v1/auth/register",
        "requestId": "280f8680-1642-4518-9b51-c3ab57010e00",
        "timestamp": "2022-06-27T12:18:36.999Z"
    }
}

Handling while trying to register with existing data and throwing 400 Bad request would be more suitable instead of 500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant