-
-
Notifications
You must be signed in to change notification settings - Fork 658
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: correct error for missing context field #3647
Conversation
When adding a strategy using a context field that did not exist, we threw an unknown error. This changes to throw NotFoundError so that our users can better know what they did wrong.
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I'd usually expect NotFoundErrors to be 404s. But if what can't be found is a nested part of a request object, shouldn't it be a 400 because the data is bad? If so, how do we differentiate between "route doesn't exist" and "your data is bad because it points to something that doesn't exist"?
We discussed the same thing, and came to the conclusion that the 404 is still a better error message than 500 UnknownError. The next step is having a strategy for the validation of constraints that changes the 404 to 400. |
When adding a strategy using a context field that did not exist, we threw an unknown error. This changes to throw NotFoundError so that our users can better know what they did wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
When adding a strategy using a context field that did not exist, we threw an unknown error. This changes to throw NotFoundError so that our users can better know what they did wrong.
When adding a strategy using a context field that did not exist, we threw an unknown error.
This changes to throw NotFoundError so that our users can better know what they did wrong.