[8.x] Give a more meaningul message when route parameters are missing #35706
+78
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The message for
UrlGenerationException
when parameters are missing is a nice start, but knowing which parameters are missing can be a huge help in figuring out where something is broken. Especially if a route has multiple possible parameters. Which parameter is actually missing? Are more than one missing? Now we'll know!For example, say a developer is presented with the following exception message:
It would lead them to their controller which might look something like this:
... it is not immediately obvious where to start. Is it that the
$connectionRequest
doesn't have aclient
? Or is the$serviceIntake
set tonull
for some reason? Or are they both having issues?With this PR, the exception message would change to one of the following:
This feedback will save the developer a lot of time trying to figure out which parameters are missing so they can get right to fixing the issue instead of digging more to figure out which parameter is actually causing the problem.
Originally targeted
8.x
with this PR, but realized it can go all the way back to6.x
, too. Let me know if you'd like me to retarget another branch or if there is anything I can do to help ensure this makes it into the most versions possible if it is accepted. :)