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

Rename \tripod\exceptions\Exception #77

Open
scaleupcto opened this issue Jul 9, 2015 · 2 comments
Open

Rename \tripod\exceptions\Exception #77

scaleupcto opened this issue Jul 9, 2015 · 2 comments

Comments

@scaleupcto
Copy link
Contributor

If you're editing a file which uses \tripod\exceptions this doesn't do what you think it does:

try {
  // do something
} catch (Exception $e) {
  // log error
} 

It actually catches \tripod\exceptions\Exception, not \Exception. Rename the former to be more specific and less bug-prone.

@rsinger
Copy link
Member

rsinger commented Jul 9, 2015

Isn't this the peril of namespaces? Even if we rename \Tripod\Exception, this code snippet wouldn't work...

@scaleupcto
Copy link
Contributor Author

Define "not work"?

If \Tripod\Exception is renamed (let's say to FooException) it's really clear the code above is not going to capture it.

At the moment a glance, especially in a PR where the file header might be suppressed from view, it's not clear which flavour of exception the above code is capturing.

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

No branches or pull requests

2 participants