Catch twig errors
This commit is contained in:
parent
69f3313f0f
commit
94ea72f26a
1 changed files with 6 additions and 16 deletions
|
@ -4,6 +4,7 @@ namespace Runtime\Http\Views;
|
||||||
|
|
||||||
|
|
||||||
use ClassNotFoundException;
|
use ClassNotFoundException;
|
||||||
|
use Runtime\Exceptions\ExceptionHandler;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Error\LoaderError;
|
use Twig\Error\LoaderError;
|
||||||
use Twig\Error\RuntimeError;
|
use Twig\Error\RuntimeError;
|
||||||
|
@ -53,23 +54,12 @@ class Factory implements \Runtime\Contracts\View\Factory {
|
||||||
$this->name = $this->name($name);
|
$this->name = $this->name($name);
|
||||||
$this->arguments = $arguments;
|
$this->arguments = $arguments;
|
||||||
|
|
||||||
if(!$this->exists()) {
|
try {
|
||||||
throw new ClassNotFoundException();
|
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue