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

What exception should throw in v2 and v3 #88

Closed
svycka opened this issue Jan 26, 2016 · 2 comments
Closed

What exception should throw in v2 and v3 #88

svycka opened this issue Jan 26, 2016 · 2 comments

Comments

@svycka
Copy link
Contributor

svycka commented Jan 26, 2016

most if not all modules throws incorrect exception not this https://github.com/zendframework/zend-servicemanager/blob/release-2.7/src/AbstractPluginManager.php#L126 examples:

is this correct behavior?
if yes then now in v3 throwing Zend\ServiceManager\InvalidServiceException can be BC break?

@kynx
Copy link
Contributor

kynx commented Jan 26, 2016

@svycka I've added some stuff about exceptions to the migration docs in #87 - I'd appreciate any feedback.

TL;DR

  • v2 should continue to throw the old exception
  • v3 should throw an InvalidServiceException (or an exception extending it)

If it's possible to change the old exception to extend InvalidServiceException while preserving BC I guess that would be the way to go. But as you note in lots of cases it's package-specific but generic (ie Exception\RuntimeException) so I guess BC breakage is inevitable.

@weierophinney
Copy link
Member

Closing; #93 and #96 allow writing tests for this behavior now, and #93 provides a methodology for throwing different exceptions in v2 usage vs v3 usage.

We will be updating the various plugin managers over the coming weeks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants