Catch twig errors

This commit is contained in:
Maarten 2019-12-23 18:56:55 +01:00
parent 69f3313f0f
commit 94ea72f26a

View file

@ -4,6 +4,7 @@ namespace Runtime\Http\Views;
use ClassNotFoundException;
use Runtime\Exceptions\ExceptionHandler;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
@ -53,23 +54,12 @@ class Factory implements \Runtime\Contracts\View\Factory {
$this->name = $this->name($name);
$this->arguments = $arguments;
if(!$this->exists()) {
throw new ClassNotFoundException();
try {
$this->render();
}
catch (\Exception $e) {
ExceptionHandler::make($e);
}
$this->render();
//TODO: Catch errors
}
/**
* @return bool
*/
private function exists()
{
$file = getcwd() . "/../resources/views/{$this->name}.html";
//TODO: Add checker
return true;
}
/**