FriendsOfSymfony/FOSRestBundle — pull request #599 by matthijsvandenbos (2013-11-11 23:08:56+00:00)
Title: Replace generic HttpExceptions with more specific subclasses

Currently, most HttpExceptions thrown are of the generic HttpException class. This pull request makes all HttpExceptions more specific, without breaking unit tests and thus BC, since they all extend from HttpException and set the same status codes.

Explanation:

It would be nice if these exceptions were more specific, so that it would work better in conjunction with `FOS\RestBundle\Controller\ExceptionController::getExceptionMessage` and the accompanying config settings as described in [the documentation](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Resources/doc/4-exception-controller-support.md):

```yaml
# app/config/config.yml
fos_rest:
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\HttpKernel\Exception\BadRequestHttpException': true
```

This way users could for instance decide to show messages for a BadRequestHttpException, but not for a UnsupportedMediaTypeHttpException.