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

fix: SQL errors as response messages #49

Open
PedroChaparro opened this issue Oct 7, 2023 · 2 comments
Open

fix: SQL errors as response messages #49

PedroChaparro opened this issue Oct 7, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@PedroChaparro
Copy link
Contributor

PedroChaparro commented Oct 7, 2023

It seems that the API is returning SQL errors in JSON responses. For instance, when I create a duplicated user, I receive the following error from the Gateway:

{
  return: {
    code: 500,
    error: true,
    msg: 'ERROR: duplicate key value violates unique constraint "users_username_key" (SQLSTATE 23505)'
  }
}

I believe it would be better if you return a specific error code like 409 (Conflict) and a custom error message such as "The username is already in use." At least in this case. Otherwise, clients will be forced to display a generic error like "There was an error creating your account," and the user will never know what the problem is.

@PedroChaparro PedroChaparro added the enhancement New feature or request label Oct 7, 2023
@PedroChaparro
Copy link
Contributor Author

What do you think? @Woynert, @shoriwe 🤔

@Woynert
Copy link
Member

Woynert commented Oct 8, 2023

I agree, this is important for user experience.

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

Successfully merging a pull request may close this issue.

3 participants