Skip to content

[PropertyAccessor] Original exception not always passed to throwUnexpectedTypeException #38621

@thelem

Description

@thelem

Description
#18210 introduced throwUnexpectedTypeException()
#34899 extended this to wrap the original exception, and passed the original exception while inside the setValue function

However, by the time this came to be merged into 4.3:
7f2d9c2
there were two calls to throwUnexpectedTypeException, and only one of them was given the original exception. It should be passed in both calls.

The benefit is as described by @Pictor13 on #34899

In my case I was passing null to a setter that was typed not to accept nulls, even though it was backed on to a nullable field. The error message I was shown made me look at my field definition, when in fact I needed to look at the setter.

Example

Screenshot of stacktrace after changing the call to pass the original exception

Screenshot_2020-10-18 Expected argument of type string , null given at property path buttonLabels (500 Internal Server Error)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions