You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
647 B
27 lines
647 B
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
require_once __DIR__ . "/../react-display.php";
|
|
|
|
use App\Validation\ValidationFail;
|
|
use Twig\Environment;
|
|
use Twig\Error\LoaderError;
|
|
use Twig\Error\RuntimeError;
|
|
use Twig\Error\SyntaxError;
|
|
|
|
class ErrorController {
|
|
/**
|
|
* @param ValidationFail[] $failures
|
|
* @param Environment $twig
|
|
* @return void
|
|
*/
|
|
public static function displayFailures(array $failures, Environment $twig): void {
|
|
try {
|
|
$twig->display("error.html.twig", ['failures' => $failures]);
|
|
} catch (LoaderError|RuntimeError|SyntaxError $e) {
|
|
echo "Twig error: $e";
|
|
}
|
|
}
|
|
}
|