23 lines
634 B
PHP
23 lines
634 B
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\ErrorHandler\Exception\FlattenException;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
class CustomErrorController extends AbstractController
|
|
{
|
|
#[Route(path: '/error', name: 'custom_error_controller')]
|
|
public function show(FlattenException $exception)
|
|
{
|
|
$statusCode = $exception->getStatusCode();
|
|
$message = $exception->getMessage();
|
|
|
|
return $this->render('error.html.twig', [
|
|
'statusCode' => $statusCode,
|
|
'message' => $message,
|
|
]);
|
|
}
|
|
}
|