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

Improve the exception message of UrlMatcher #11767

Merged
merged 1 commit into from Aug 27, 2014

Conversation

dawehner
Copy link
Contributor

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

@@ -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");
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@dawehner dawehner closed this Aug 26, 2014
@dawehner dawehner deleted the urlmatcher-exception-message branch August 26, 2014 10:52
@dawehner
Copy link
Contributor Author

meh

@dawehner dawehner reopened this Aug 26, 2014
@@ -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));
Copy link
Member

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.

@dawehner dawehner closed this Aug 26, 2014
@stof
Copy link
Member

stof commented Aug 26, 2014

why cloding it ?

@dawehner
Copy link
Contributor Author

What means cloding? http://www.dict.cc/?s=cloding

@yguedidi
Copy link
Contributor

closing*

@dawehner
Copy link
Contributor Author

Ehem, I am primarily stupid.

@dawehner dawehner reopened this Aug 26, 2014
@stof
Copy link
Member

stof commented Aug 26, 2014

👍

@@ -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));
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @fabpot.

@fabpot
Copy link
Member

fabpot commented Aug 27, 2014

👍

@fabpot
Copy link
Member

fabpot commented Aug 27, 2014

Thank you @dawehner.

@fabpot fabpot merged commit ee1197d into symfony:master Aug 27, 2014
fabpot added a commit that referenced this pull request Aug 27, 2014
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.
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

Successfully merging this pull request may close these issues.

None yet

6 participants