Skip to content

The exceptionToStatus mapping feature seems broken #4848

Description

@rvanlaak

API Platform version(s) affected: 3.0.0-beta.2

Description

The exceptionToStatus mapping feature seems broken, when configuring error mapping on an ApiResource. The http response code still will be a http 500 error.

How to reproduce

namespace App\Application\ReadModel\Projection;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Application\ReadModel\ProductProvider;
use App\Domain\ReadModel\Product\NotFoundException;

#[ApiResource(
    provider: ProductProvider::class,
    operations: [
        new Get(
            exceptionToStatus: [
                [NotFoundException::class => 404]
            ],
        )
    ]
)]
final class Product
{
    // ...
}

Possible Solution

Not sure how I can debug this further, as we get the same http 500 error as on our other endpoint.

Additional Context

  • Did do a fresh installation of API Platform v3.0.0-beta.2 on an existing project
  • PHP 8.1
  • Symfony 6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions