Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

fix dispatcher to catch legitimate exceptions #3405

Merged
merged 3 commits into from
Jan 14, 2013

Conversation

radnan
Copy link
Contributor

@radnan radnan commented Jan 10, 2013

All service managers throw the same ServiceNotFound and ServiceNotCreated exceptions.

The dispatcher made no distinctions between:

  • exceptions thrown in the event a controller can't be loaded; and
  • exceptions thrown from initializers within ControllerLoader

The first case is a legitimate "controller-not-found" error and can be tested for using the ServiceManager::has() method whereas the second case needs to be caught and forwarded to a 500 status page.

All service managers throw the same ServiceNotFound and
ServiceNotCreated exceptions.

The dispatcher made no distinctions between:
* exceptions thrown in the event a controller can't be loaded; and
* exceptions thrown from initializers within ControllerLoader

The first case is a legitimate "controller-not-found" error
and can be tested for using the "ServiceManager::has()" method whereas
the second case needs to be caught and forwarded to a 500 status page.
@weierophinney
Copy link
Member

I have one doubt: can you test this against a controller manager that composes an abstract factory, please? I have a vague recollection that has() does not query those, which is why we went the route we did. If that's no longer the case, I'll be happy to merge!

@radnan
Copy link
Contributor Author

radnan commented Jan 11, 2013

@weierophinney done. I'm afraid unit testing is my weak spot, let me know if I missed any test cases.

I also tested it with a sample project of my own. ServiceManager::has() has a second argument which will look through abstract factories if true. So we should be good there.

@ghost ghost assigned weierophinney Jan 14, 2013
weierophinney added a commit that referenced this pull request Jan 14, 2013
- Indentation, trailing whitespace
@weierophinney weierophinney merged commit 3d3ad86 into zendframework:develop Jan 14, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants