getStatusCode() != 404) { $mailDebug = $this->getParameter('app.mail_debug'); if ($mailDebug) { $message = "URL : " . $request->getUri() . "
"; $message .= "Code : " . $exception->getStatusCode() . "
"; $message .= "Message : " . $exception->getMessage() . "
"; $message .= "File : " . $exception->getFile() . "
"; $message .= "Line : " . $exception->getLine() . "

"; $message .= "Trace :
" . str_replace("\n", "
", $exception->getTraceAsString()); $siteName = $this->getParameter('app.site_name'); $email = (new Email()) ->from('nepasrepondre@laclic.fr') ->to($mailDebug) ->subject( '[' . $siteName . '] [ERREUR ' . $exception->getStatusCode() . '] ' . $exception->getMessage() . '' ) ->text(strip_tags($message)) ->html($message); $mailer->send($email); } } if ($exception->getStatusCode() == 404) { return $this->render('bundles/TwigBundle/Exception/error404.html.twig', [ "code" => $exception->getStatusCode(), "message" => $exception->getMessage() ]); } if (str_contains($this->getRequestStack()->getCurrentRequest(), "/admin")) { return $this->render('@LcSov/exception/error.html.twig', [ "code" => $exception->getStatusCode(), "message" => $exception->getMessage() ]); } else { return $this->render('bundles/TwigBundle/Exception/error.html.twig', [ "code" => $exception->getStatusCode(), "message" => $exception->getMessage() ]); } } }