use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; function callback() { throw new AccessDeniedHttpException(); throw new NotFoundHttpException(); }