From ec8c3d9e602a669ff128f4e68045a7fe56537d3f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 14:47:48 +0300 Subject: [PATCH] Better error message when template file isn't found --- system/src/Grav/Common/Twig.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Twig.php b/system/src/Grav/Common/Twig.php index d694ca160..f0c88bf5c 100644 --- a/system/src/Grav/Common/Twig.php +++ b/system/src/Grav/Common/Twig.php @@ -233,7 +233,12 @@ class Twig // Get Twig template layout $template = $this->template($page->template() . $ext); - $output = $this->twig->render($template, $twig_vars); + + try { + $output = $this->twig->render($template, $twig_vars); + } catch (\Twig_Error_Loader $e) { + throw new \RuntimeException('Resource not found.', 404, $e); + } return $output; }