I am trying to throw exceptions and I am doing the following:
use Symfony\Component\HttpKernel\Exception\HttpNotFoundException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
I am then using them the following way:
throw new HttpNotFoundException("Page not found");
throw $this->createNotFoundException('The product does not exist');
however I am getting errors like HttpNotFoundException is not found etc.
Is this the best way to throw exceptions?
Try:
and
I think you got it a bit backwards 🙂