{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1357","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1357/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1357/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1357/events","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1357","id":136421996,"number":1357,"title":"Interaction between \"ExceptionController support\" and \"Forms errors wrapper\"","user":{"login":"Abam","id":5353828,"avatar_url":"https://avatars.githubusercontent.com/u/5353828?v=3","gravatar_id":"","url":"https://api.github.com/users/Abam","html_url":"https://github.com/Abam","followers_url":"https://api.github.com/users/Abam/followers","following_url":"https://api.github.com/users/Abam/following{/other_user}","gists_url":"https://api.github.com/users/Abam/gists{/gist_id}","starred_url":"https://api.github.com/users/Abam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abam/subscriptions","organizations_url":"https://api.github.com/users/Abam/orgs","repos_url":"https://api.github.com/users/Abam/repos","events_url":"https://api.github.com/users/Abam/events{/privacy}","received_events_url":"https://api.github.com/users/Abam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-25T15:32:46Z","updated_at":"2016-02-26T06:20:46Z","closed_at":null,"body":"I was reading the official documentation for [ExceptionController support](http://symfony.com/doc/1.7/bundles/FOSRestBundle/4-exception-controller-support.html) and the [Form and views](http://symfony.com/doc/1.7/bundles/FOSRestBundle/2-the-view-layer.html#forms-and-views) sections and it got a little bit confused.\r\n\r\nI dig into the code and found out that the `fos_rest.exception_handler` and the `fos_rest.view.exception_wrapper_handler` are tightly linked.\r\n\r\nIf I only set a custom service for the `exception_handler`, the `fos_rest.view.exception_wrapper_handler` is **not used anymore** neither by the ExceptionController nor the ViewHandler.\r\nIf I only set a custom `exception_wrapper_handler`, it is used by both the ExceptionController and the ViewHandler.\r\n\r\nI realised that by default, the `fos_rest.exception_handler` is an alias to `fos_rest.view.exception_wrapper_handler` and is used by both the ExceptionController and the ViewHandler. There is no way to have 2 differents services for them. \r\nIs it the wanted behavior ? \r\n\r\n\r\nJust for readers, here are the relevant configuration keys used.\r\n```\r\n# app/config/config.yml\r\nfos_rest:\r\n    service:\r\n        exception_handler:    fos_rest.view.exception_wrapper_handler\r\n    view:\r\n        # only relevant when using the JMS serializer for serialization\r\n        exception_wrapper_handler:  null\r\n```"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/comments/189128930","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1357#issuecomment-189128930","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1357","id":189128930,"user":{"login":"Abam","id":5353828,"avatar_url":"https://avatars.githubusercontent.com/u/5353828?v=3","gravatar_id":"","url":"https://api.github.com/users/Abam","html_url":"https://github.com/Abam","followers_url":"https://api.github.com/users/Abam/followers","following_url":"https://api.github.com/users/Abam/following{/other_user}","gists_url":"https://api.github.com/users/Abam/gists{/gist_id}","starred_url":"https://api.github.com/users/Abam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abam/subscriptions","organizations_url":"https://api.github.com/users/Abam/orgs","repos_url":"https://api.github.com/users/Abam/repos","events_url":"https://api.github.com/users/Abam/events{/privacy}","received_events_url":"https://api.github.com/users/Abam/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T06:20:46Z","updated_at":"2016-02-26T06:20:46Z","body":"With the 2.0, I could be possible (wrapper is injected as a dependency) but unfortunately, as of 1.7 and 1.8, the same service is fetched by the [ExceptionHandler](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/1.8/Controller/ExceptionController.php#L63) and the [ViewHandler](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/1.7/View/ViewHandler.php#L527) directly from the container, so I can't tweak it  separately.\r\nI've decided to use the `exception_wrapper_handler` config param to setup one wrapper for both cases.\r\nBy the way, the comment above the param `# only relevant when using the JMS serializer for serialization` seems wrong since the wrapper is called before any serialization processing."}}