【发布时间】:2011-10-14 13:11:37
【问题描述】:
总结一下:我有一个从 \Exception 扩展而来的异常类 (\core\exceptions\GuruMeditationException)。其他所有异常类都只是从我自己的异常类扩展而来。 当我的代码运行并引发异常时,一切对我来说都很完美。
现在: 假设我有一个从 \core\base\mvc\View 扩展的类 (\app\HomeView)。那里抛出的异常也被很好地捕获。类声明如下所示:
namespace app;
class HomeView extends \core\base\mvc\View {
}
但是: 如果我执行以下操作:
namespace app;
class HomeView extends \core\base\mvc\DoesNotExist { # line 5
}
然后不再捕获异常。 我已经尝试捕获我创建的所有异常,无论有无命名空间。我也试图捕捉 'Exception' 和 '\Exception' 但没有任何帮助。 相反,我收到类似的错误:
Fatal error: Class 'core\base\mvc\DoesNotExistView' not found in /var/www/abuhome/htdocs/test-namespace/class/HomeView.class.php on line 5
Call Stack:
0.0001 635104 1. {main}() /var/www/abuhome/htdocs/test-namespace/index.php:0
0.0135 1536280 2. core\Quantum->make() /var/www/abuhome/htdocs/test-namespace/index.php:36
0.0135 1540880 3. core\scriptlet\ProtocolScriptlet->dispatch() /home/equinox/qf-namespace/class/Quantum.class.php:124
0.0136 1540880 4. core\scriptlet\XhtmlScriptlet->dispatch() /home/equinox/qf-namespace/class/scriptlet/ProtocolScriptlet.class.php:39
0.0136 1540880 5. core\template\tpl\TplContainerParser->parseContainerFile() /home/equinox/qf-namespace/class/scriptlet/XhtmlScriptlet.class.php:22
0.0139 1564656 6. core\scriptlet\ContentScriptlet->executeSuitingRequestParameter() /home/equinox/qf-namespace/class/template/tpl/TplContainerParser.class.php:42
0.0139 1564656 7. core\scriptlet\ContentScriptlet->processMainContent() /home/equinox/qf-namespace/class/scriptlet/ContentScriptlet.class.php:145
0.0141 1573640 8. core\scriptlet\ContentScriptlet->processModule() /home/equinox/qf-namespace/class/scriptlet/ContentScriptlet.class.php:154
0.0143 1583808 9. include('/var/www/abuhome/htdocs/test-namespace/modules/home.php') /home/equinox/qf-namespace/class/scriptlet/ContentScriptlet.class.php:174
0.0143 1584248 10. uses() /var/www/abuhome/htdocs/test-namespace/modules/home.php:4
0.0151 1637696 11. require_once('/var/www/abuhome/htdocs/test-namespace/class/HomeView.class.php') /home/equinox/qf-namespace/functions/uses.function.php:49
谁能帮帮我?我想我忘记了什么,但我不知道它是什么>.
谢谢你
【问题讨论】:
-
@Phil 编辑按钮就在问题下方...
-
@Juhana 我宁愿特里斯坦从我的评论中学习
标签: php exception frameworks namespaces nested