From 8f7ccd13553b59c7e7721f08d5fc620a0d6bcfa7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Jul 2012 08:26:32 +0200 Subject: [PATCH] moved an exception --- lib/Twig/Loader/Filesystem.php | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index 08e1f73..d37e01f 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -145,15 +145,15 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface $namespace = '__main__'; if (isset($name[0]) && '@' == $name[0]) { if (false === $pos = strpos($name, '/')) { - throw new \InvalidArgumentException(sprintf('Malformed template name "%s".', $name)); + throw new \InvalidArgumentException(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); } $namespace = substr($name, 1, $pos - 1); - $name = substr($name, $pos + 1); - } + if (!isset($this->paths[$namespace])) { + throw new \Twig_Error_Loader(sprintf('There is not registered paths for path name "%s".', $namespace)); + } - if (!isset($this->paths[$namespace])) { - throw new \Twig_Error_Loader(sprintf('There is not registered paths for path name "%s".', $namespace)); + $name = substr($name, $pos + 1); } foreach ($this->paths[$namespace] as $path) { -- 1.7.2.5