Skip to content

Release 3.2: ErrorNormalizer not being used, ErrorResource used instead #5921

@HectorOrdonez

Description

@HectorOrdonez

API Platform version(s) affected: 3.2.*

Description
In 3.1.19 I have a decorated ErrorNormalizer, so I can add customised data to the exception.

That worked fine.

In 3.2.* tests are failing because the expected custom data is not being returned.

After debugging the conclusion is that ErrorNormalizer is not being used, therefore the decoration logic is not reached.

It seems like the ErrorResource (ApiResource/Error.php) is used instead.

I see we have now deprecation messages in the ErrorNormalizer and what seems to be a feature flag skip_deprecated_exception_normalizers, but the logic doesn't reach there at all.

The code that seems to be related to the problem is this one.

However I am having a hard time figuring out which part, and how can I solve this problem, if it is in my side.

How to reproduce
I am not sure exactly what part is the problem, but I am guessing the decoration of the exception.

So the configuration would be something like:

    MyApp\ApiPlatform\Serializer\ErrorNormalizer:
        decorates: 'api_platform.problem.normalizer.error'

The logic of the decorator doesn't really matter, since it is not reached at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions