hydra-sql/src/Controller/CustomErrorController.php

23 lines
634 B
PHP
Raw Normal View History

<?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,
]);
}
}