-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(Dispatcher): Catch TypeErrors and turn them into bad request responses #54534
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
Conversation
susnux
left a comment
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.
Is really every type error a bad request? This seems to be very broad as there could also just be application logic issues in the controller?
|
Hm yes it could also be the fault of the code, but I think it is way more likely that it happens when the method is called and the request didn't provide valid parameters. |
how expensive would it be to use reflections and check this before? |
|
Probably not expensive, since we already use reflection before to cast the values, but it will be a lot of messy code that might be incomplete. I would not go this route, so either we merge this PR or close it. |
|
This will be very painful for developers trying to figure out why something is not working during development 🙈 What I could see would be: when we have a TypeError, check if it's from the Controller::method call, if yes => debug, otherwise => error. |
7cc04dd to
5937a87
Compare
|
It was actually quite easy to check with reflection whether the TypeError happened when calling the controller method or if it happened later on. |
nickvergessen
left a comment
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.
🛑 Sounds okay to merge after branch off then? :P
|
@provokateurin Cypress seems to be related |
|
Runner 8 with theming/admin-settings.cy.ts or something else? |
…onses Signed-off-by: provokateurin <kate@provokateurin.de>
5937a87 to
9473f47
Compare
|
Hm I do not get it, it was broken with 8 retries and a rebase just fixed it... |
Prevents error messages like this:
The server is not doing anything wrong in this case and there is nothing the admin can do about it, because client is not sending a valid request to the endpoint.