I try to add an exeption when i a page not found, 404.
So i add this is ocnfig fos_rest :
# exception:
# codes:
# 'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
# 'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
# messages:
# 'Acme\HelloBundle\Exception\MyExceptionWithASafeMessage': true
But i have this error :
FOSRestBundle exception mapper: Could not load class 'Acme\HelloBundle\Exception\MyExceptionWithASafeMessage' or the class does not extend from '\Exception'. Most probably this is a configuration problem.
Since the namespace is acme it looks like you copied some demo tutorial code and the bundle doesn't exist.
You need to create your OWN exception class extending \Exception and pass its namespace there in the yml .