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 exception messages #326

Merged
merged 4 commits into from
Sep 18, 2015
Merged

Improve exception messages #326

merged 4 commits into from
Sep 18, 2015

Conversation

mnapoli
Copy link
Member

@mnapoli mnapoli commented Sep 16, 2015

Improve exception messages: simpler and more consistent. Added more tests too.


Before

Entry DI\Test\IntegrationTest\ErrorMessages\Buggy1 cannot be resolved: The parameter 'bar' of DI\Test\IntegrationTest\ErrorMessages\Buggy1::__construct has no value defined or guessable
Object (
    class = DI\Test\IntegrationTest\ErrorMessages\Buggy1
    scope = singleton
    lazy = false
    __construct(
        $foo = 'some value'
        $bar = #UNDEFINED#
        $default = (default value) 123
    )
)

After

Entry "DI\Test\IntegrationTest\ErrorMessages\Buggy1" cannot be resolved: Parameter $bar of __construct() has no value defined or guessable
Object (
    class = DI\Test\IntegrationTest\ErrorMessages\Buggy1
    scope = singleton
    lazy = false
    __construct(
        $foo = 'some value'
        $bar = #UNDEFINED#
        $default = (default value) 123
    )
)

Before

Entry DI\Test\IntegrationTest\ErrorMessages\InterfaceFixture cannot be resolved: class DI\Test\IntegrationTest\ErrorMessages\InterfaceFixture is not instantiable
Full definition:
Object (
    class = #NOT INSTANTIABLE# DI\Test\IntegrationTest\ErrorMessages\InterfaceFixture
    scope = singleton
    lazy = false
)

After

Entry "DI\Test\IntegrationTest\ErrorMessages\InterfaceFixture" cannot be resolved: the class is not instantiable
Full definition:
Object (
    class = #NOT INSTANTIABLE# DI\Test\IntegrationTest\ErrorMessages\InterfaceFixture
    scope = singleton
    lazy = false
)

Before

The factory definition "Acme\UserRepository" is not callable: RepositoryFactory is neither a callable or a valid container entry

After

Entry "Acme\UserRepository" cannot be resolved: factory "RepositoryFactory" is neither a callable nor a valid container entry

@mnapoli mnapoli added this to the 5.2 milestone Sep 16, 2015
mnapoli added a commit that referenced this pull request Sep 18, 2015
@mnapoli mnapoli merged commit 0cfa9fd into master Sep 18, 2015
@mnapoli mnapoli deleted the exception_messages branch September 18, 2015 07:12
jdreesen added a commit to jdreesen/PHP-DI that referenced this pull request Sep 19, 2015
@jdreesen jdreesen mentioned this pull request Sep 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant