Skip to content

Improve exception messages#326

Merged
mnapoli merged 4 commits intomasterfrom
exception_messages
Sep 18, 2015
Merged

Improve exception messages#326
mnapoli merged 4 commits intomasterfrom
exception_messages

Conversation

@mnapoli
Copy link
Copy Markdown
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