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

4.0 breaks error handling compatibility #6729

Open
ostrolucky opened this issue Oct 15, 2024 · 4 comments
Open

4.0 breaks error handling compatibility #6729

ostrolucky opened this issue Oct 15, 2024 · 4 comments

Comments

@ostrolucky
Copy link
Contributor

API Platform version(s) affected: 4.x

Description
I can't seem to make our error handling integration tests pass on api-platform 4.x

How to reproduce
Here are the relevant parts of the configuration used in api-platform/core:3.*:

api_platform:
  use_symfony_listeners: true
  handle_symfony_errors: true

Test:

Scenario: Invalid request
    When I add "Content-Type" header equal to "application/ld+json"
    And I add "Accept" header equal to "application/json"
    And I send a "POST" request to "/api/bulk-resend-activation-mail" with body:
    """
     invalid input{
    """
    Then the response status code should be 400

api-platform/core: 3.x:

api-platform/core: 4.x: (click to enlarge)

Possible Solution

Additional Context

@soyuka
Copy link
Member

soyuka commented Oct 16, 2024

Mhh you never reach this line right?

$this->errorListener->onKernelException($event);

Is your endpoint an API Resource?

Another lead would be that this patch 7399fcf changes something in your case but I need to know if you reach the previous mentioned line first.

@ostrolucky
Copy link
Contributor Author

It does trigger that line. Inside, exception is rethrown as BadRequestHttpException, but that one doesn't seem to be handled further.

And that endpoint is not an API resource.

Copy link

stale bot commented Dec 15, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 15, 2024
soyuka added a commit to soyuka/core that referenced this issue Dec 16, 2024
@soyuka
Copy link
Member

soyuka commented Dec 16, 2024

I tried to reproduce at 1096084 but I successfully got a 400. To run the test:

USE_SYMFONY_LISTENERS=true vendor/bin/phpunit tests/Functional/Symfony/ErrorTest.php

Did I forgot something?

@stale stale bot removed the stale label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants