diff --git a/Twig.php b/Twig.php index a76ddd2..c0e328e 100644 --- a/Twig.php +++ b/Twig.php @@ -113,11 +113,16 @@ public function getInstance() * Check if Twig_Autoloader class exists * otherwise include it. */ - if (!class_exists('\Twig_Autoloader')) { - require_once $this->parserDirectory . '/Autoloader.php'; - } + try { + if (!class_exists('\Twig_Autoloader')) { + require_once $this->parserDirectory . '/Autoloader.php'; + } - \Twig_Autoloader::register(); + \Twig_Autoloader::register(); + } catch (\ErrorException $e) { + $app = \Slim\Slim::getInstance(); + $app->log->error($e->getMessage()); + } $loader = new \Twig_Loader_Filesystem($this->getTemplateDirs()); $this->parserInstance = new \Twig_Environment( $loader,