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

Throw 400 exception when crudQuery is invalid #365

Open
khalibloo opened this issue Dec 23, 2022 · 1 comment
Open

Throw 400 exception when crudQuery is invalid #365

khalibloo opened this issue Dec 23, 2022 · 1 comment

Comments

@khalibloo
Copy link

A malformed crudQuery in the request params causes a 500 currently. A better and more accurate error would be 400.

@kepelrs
Copy link
Owner

kepelrs commented Apr 9, 2023

If I understand correctly, you a referring to cases where prisma itself throws due invalid fields in the query (for example a typo in the column name).

The reason the package doesn't catch the error and throw 400 is because we can't know for sure who provided the invalid property. It could be the client, but it could also be some AccessPolicy in which case 500 is appropriate (server logic).

I'm hoping by now prisma has some API to help us validate the client's crudQuery before applying the AccessPolicy constraints. That would at least bring us closer to being able to throw 400, but I still haven't had time to look into it. PR's are welcome if you have any ideas.

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

No branches or pull requests

2 participants