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 the exception message of UrlMatcher #11767
Conversation
@@ -93,7 +93,7 @@ public function match($pathinfo) | |||
|
|||
throw 0 < count($this->allow) | |||
? new MethodNotAllowedException(array_unique(array_map('strtoupper', $this->allow))) | |||
: new ResourceNotFoundException(); | |||
: new ResourceNotFoundException("No routes found for $pathinfo"); |
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.
building the exception message should use sprintf rather than interpolation
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.
fixed
meh |
@@ -93,7 +93,7 @@ public function match($pathinfo) | |||
|
|||
throw 0 < count($this->allow) | |||
? new MethodNotAllowedException(array_unique(array_map('strtoupper', $this->allow))) | |||
: new ResourceNotFoundException(); | |||
: new ResourceNotFoundException(sprintf('No routes found for %s', $pathinfo)); |
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.
All our error messages should end with a dot.
why cloding it ? |
What means cloding? http://www.dict.cc/?s=cloding |
closing* |
Ehem, I am primarily stupid. |
👍 |
@@ -93,7 +93,7 @@ public function match($pathinfo) | |||
|
|||
throw 0 < count($this->allow) | |||
? new MethodNotAllowedException(array_unique(array_map('strtoupper', $this->allow))) | |||
: new ResourceNotFoundException(); | |||
: new ResourceNotFoundException(sprintf('No routes found for %s.', $pathinfo)); |
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.
What about enclosing the value in double quotes?
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.
oops, I saw your message after merging this PR. I fixed the double-quotes in df244f2
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.
Thank you @fabpot.
👍 |
Thank you @dawehner. |
This PR was merged into the 2.6-dev branch. Discussion ---------- Improve the exception message of UrlMatcher The current exception message is not optimal, some more context always helps. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Commits ------- ee1197d Improve the exception message in the UrlMatcher.
The current exception message is not optimal, some more context always helps.