Skip to content

docs(errors): warn that exception_to_status is not merged with defaults#2291

Merged
soyuka merged 2 commits into
api-platform:4.3from
soyuka:docs/exception-to-status-not-merged-6116
Jun 11, 2026
Merged

docs(errors): warn that exception_to_status is not merged with defaults#2291
soyuka merged 2 commits into
api-platform:4.3from
soyuka:docs/exception-to-status-not-merged-6116

Conversation

@soyuka

@soyuka soyuka commented Jun 11, 2026

Copy link
Copy Markdown
Member

Documentation

Closes api-platform/core#6116

When a custom exception_to_status mapping is declared, it replaces the built-in defaults entirely instead of merging with them. If a user omits the default handlers, exceptions previously mapped to 400 — notably Symfony\Component\Serializer\Exception\ExceptionInterface thrown when denormalizing a relation to a non-existing item, or an invalid backed enum value — fall through to the 500 fallback.

The example already carried inline "keep those lines" comments; this adds an explicit warning callout explaining why the default lines must be kept.

soyuka added 2 commits June 11, 2026 15:05
Declaring a custom exception_to_status mapping replaces the built-in one
entirely rather than merging. Omitting the default handlers makes
serializer exceptions (non-existing relation item, invalid backed enum)
fall through to the 500 fallback instead of 400.

Closes #6116
@soyuka soyuka merged commit cf25f58 into api-platform:4.3 Jun 11, 2026
3 checks passed
@soyuka soyuka deleted the docs/exception-to-status-not-merged-6116 branch June 11, 2026 13:24
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

Successfully merging this pull request may close these issues.

1 participant