@ -0,0 +1,20 @@
|
|||||||
<?php
|
|||||||
|
|||||||
namespace App\Controller;
|
|||||||
|
|||||||
require_once __DIR__ . "/../react-display.php";
|
|||||||
use \Twig\Environment;
|
|||||||
use Twig\Error\LoaderError;
|
|||||||
use Twig\Error\RuntimeError;
|
|||||||
use Twig\Error\SyntaxError;
|
|||||||
|
|||||||
class ErrorController
|
|||||||
{
|
|||||||
public static function displayFailures(array $failures, Environment $twig) {
|
|||||||
try {
|
|||||||
vivien.dufour marked this conversation as resolved
|
|||||||
$twig->display("error.html.twig", ['failures' => $failures]);
|
|||||||
} catch (LoaderError | RuntimeError | SyntaxError $e) {
|
|||||||
echo "Twig error: $e";
|
|||||||
}
|
|||||||
}
|
|||||||
}
|
|||||||
vivien.dufour marked this conversation as resolved
|
@ -0,0 +1,57 @@
|
|||||||
<!DOCTYPE html>
|
|||||||
<html lang="en">
|
|||||||
<head>
|
|||||||
<meta charset="UTF-8">
|
|||||||
<title>Error</title>
|
|||||||
<style>
|
|||||||
body {
|
|||||||
display: flex;
|
|||||||
flex-direction: column;
|
|||||||
align-items: center;
|
|||||||
justify-content: center;
|
|||||||
height: 100vh;
|
|||||||
margin: 0;
|
|||||||
}
|
|||||||
|
|||||||
h1 {
|
|||||||
color: #da6110;
|
|||||||
text-align: center;
|
|||||||
margin-bottom: 15px
|
|||||||
}
|
|||||||
|
|||||||
vivien.dufour marked this conversation as resolved
|
|||||||
h2 {
|
|||||||
text-align: center;
|
|||||||
margin-bottom: 15px;
|
|||||||
margin-top: 15px
|
|||||||
}
|
|||||||
|
|||||||
.button {
|
|||||||
display: block;
|
|||||||
cursor : pointer;
|
|||||||
background-color: white;
|
|||||||
color : black;
|
|||||||
text-align: center;
|
|||||||
font-size: 20px;
|
|||||||
border-radius: 12px;
|
|||||||
border : 2px solid #da6110;
|
|||||||
margin-top: 15px;
|
|||||||
}
|
|||||||
|
|||||||
.button:hover {
|
|||||||
background-color: #da6110
|
|||||||
}
|
|||||||
</style>
|
|||||||
</head>
|
|||||||
<body>
|
|||||||
|
|||||||
<h1>IQBall</h1>
|
|||||||
|
|||||||
{% for fail in failures %}
|
|||||||
<h2>{{ fail.getKind() }} : {{ fail.getMessage() }}</h2>
|
|||||||
{% endfor %}
|
|||||||
|
|||||||
|
|||||||
<button class="button" onclick="location.href='/'" type="button">Retour à la page d'accueil</button>
|
|||||||
|
|||||||
</body>
|
|||||||
</html>
|
|||||||
vivien.dufour marked this conversation as resolved
|
Loading…
Reference in new issue
why use a gateway in something that only displays an error view ?
Moreover, it is not used anywhere in the class, you should remove it