Skip to content

Make Exception status codes configurable #405

Description

@salahm

Hello All,

It would be great to let the user mapping Status Codes to any exceptions. it will avoid writing "unnecessary" code to catch and rethrow exception

This feature is already implemented on FosRest

http://symfony.com/doc/master/bundles/FOSRestBundle/4-exception-controller-support.html

# app/config/config.yml
fos_rest:
    exception:
        codes:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
            'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
        messages:
            'Acme\HelloBundle\Exception\MyExceptionWithASafeMessage': true

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions