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

Improve Prisma client error code to HTTP status code mapping #384

Open
shayneczyzewski opened this issue Dec 7, 2021 · 3 comments
Open
Labels
enhancement New feature or request hacktoberfest This issue is perfect for HacktoberFest contributors webdev

Comments

@shayneczyzewski
Copy link
Sponsor Contributor

When saving things to the database with Prisma, many things can potentially go wrong. We need to indicate them to clients in ways that are actionable when they can correct them (e.g., status code 422 on bad input), or otherwise when they cannot (e.g., status code 500 when things are really wrong on backend).

We currently have a basic helper in place [waspc/data/Generator/templates/server/src/utils.js] that can check if an Error is a Prisma client error, and convert it to an HttpError. It is used during the sign up flow [waspc/data/Generator/templates/server/src/routes/auth/signup.js]. However, the mapping is incomplete. We need to thoroughly review https://www.prisma.io/docs/reference/api-reference/error-reference and determine what HTTP status code/message we should send from the controller to the frontend in each case.

This may also require refactoring the existing helpers, and allowing more flexible uses.

@shayneczyzewski shayneczyzewski added enhancement New feature or request good first issue Good for newcomers no-haskell Coding task that does not need Haskell knowledge labels Dec 7, 2021
@maksim36ua maksim36ua added webdev and removed no-haskell Coding task that does not need Haskell knowledge labels Sep 27, 2022
@maksim36ua maksim36ua added the hacktoberfest This issue is perfect for HacktoberFest contributors label Oct 3, 2022
@makinox
Copy link

makinox commented Oct 3, 2022

Hello, can I take this task?

@weedertree
Copy link

could you assign me with this issue

@Martinsos
Copy link
Member

@weedertree last time we went after this one it proved to be a bit more complex than we expected. I will remove "good first issue" from it as I don't think is qualifies as one any more.
If you do wish to go after this, I recommend giving a look at this PR #744 and continuing conversation with that knowledge.

@Martinsos Martinsos removed the good first issue Good for newcomers label Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest This issue is perfect for HacktoberFest contributors webdev
Projects
None yet
Development

No branches or pull requests

5 participants