{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1177","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1177/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1177/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1177/events","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1177","id":111793879,"number":1177,"title":"FOSRestBundle returns error 500 for NotFoundHttpException","user":{"login":"mnapoli","id":720328,"avatar_url":"https://avatars.githubusercontent.com/u/720328?v=3","gravatar_id":"","url":"https://api.github.com/users/mnapoli","html_url":"https://github.com/mnapoli","followers_url":"https://api.github.com/users/mnapoli/followers","following_url":"https://api.github.com/users/mnapoli/following{/other_user}","gists_url":"https://api.github.com/users/mnapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/mnapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnapoli/subscriptions","organizations_url":"https://api.github.com/users/mnapoli/orgs","repos_url":"https://api.github.com/users/mnapoli/repos","events_url":"https://api.github.com/users/mnapoli/events{/privacy}","received_events_url":"https://api.github.com/users/mnapoli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/labels/verified","name":"verified","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-16T09:22:24Z","updated_at":"2015-10-19T08:45:49Z","closed_at":null,"body":"The [ExceptionController](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Controller/ExceptionController.php#L90-L94) is catching any exception and returning an error 500. That means that when the router cannot find a route (e.g. we ask for a weird URL), instead of getting a 404 (`Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException`) we get a 500 (no route found for '…').\r\n\r\nIs that a problem with FOSRestBundle or am I doing something wrong?\r\n\r\nHere is my config:\r\n\r\n```yaml\r\nfos_rest:\r\n    routing_loader:\r\n        default_format: json\r\n    routing_loader:\r\n        include_format: false\r\n    exception:\r\n        codes:\r\n            '…\\Exception\\NotFound': 404\r\n        messages:\r\n            '…\\Exception\\NotFound': true\r\n            'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException': true\r\n```"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/comments/149148119","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1177#issuecomment-149148119","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1177","id":149148119,"user":{"login":"mnapoli","id":720328,"avatar_url":"https://avatars.githubusercontent.com/u/720328?v=3","gravatar_id":"","url":"https://api.github.com/users/mnapoli","html_url":"https://github.com/mnapoli","followers_url":"https://api.github.com/users/mnapoli/followers","following_url":"https://api.github.com/users/mnapoli/following{/other_user}","gists_url":"https://api.github.com/users/mnapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/mnapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnapoli/subscriptions","organizations_url":"https://api.github.com/users/mnapoli/orgs","repos_url":"https://api.github.com/users/mnapoli/repos","events_url":"https://api.github.com/users/mnapoli/events{/privacy}","received_events_url":"https://api.github.com/users/mnapoli/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T08:45:49Z","updated_at":"2015-10-19T08:45:49Z","body":"OK I understand thanks. Should I close this issue?"}}