Skip to content

exception_to_status suggestions #8405

Description

@VincentLanglet

Description
Hi @soyuka, I hope you're going well.

I just tried to use exception_to_status and had two suggestions. I wanted to get your opinion about it.

First, I find not friendly the fact we have to copy the defaut from ApiPlatform when we want to add an extra exception.
It implies:

  • that we know the default value
  • that if ApiPlatform add an extra value we update our config (or do not enjoy the default values)

I wonder if a better pattern for the option could be interesting.
Like adding another option exception_to_status_strategy: override/merge. To decide if we want to merge or override with the default value.

Secondly the context in which I wanted to add exception_to_status to the config was for

Doctrine\DBAL\Exception\UniqueConstraintViolationException

This could be consider as a 409 (I think ? Or a 422) ? Rather a 500.

In the same way OptimisticLockException is already mapped to a 409. WDYT ?

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