Symfony2 y lanzando error de excepción.
Estoy tratando de lanzar excepciones y estoy haciendo lo siguiente:
use Symfony\Component\HttpKernel\Exception\HttpNotFoundException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
Entonces los estoy usando de la siguiente manera:
throw new HttpNotFoundException("Page not found");
throw $this->createNotFoundException('The product does not exist');
Sin embargo, estoy recibiendo errores como no se encuentra la excepción HttpNotFoundException, etc.
¿Es esta la mejor manera de lanzar excepciones?