在我的应用程序的Module.php的 onBootstrap 中,我在EVENT_DISPATCH和EVENT_DISPATCH_ERROR事件上注册了一个函数 onErrors . 在我的任何一个模型中,如果我抛出一个自定义错误,Zend将为我和 onErrors 函数捕获它,我可以处理错误(显示错误页面,以json返回错误消息等) . 这种方法很好,除非在Smarty使用的函数中抛出错误 . 在那种情况下,我仍然最终在 onErrors ,但 McvEvent->exception 是NULL,我收到此错误:

致命错误:未处理的异常'Application \ Exception \ InternalServerErrorException'在/........../module/Smarty/src/Smarty/View/Renderer.php:90堆栈跟踪:#0 / ... ......./ vendor / zendframework / zendframework / library / Zend / View / View.php(205):Smarty \ View \ Renderer-> render(对象(Zend \ View \ Model \ ViewModel))#1 / .......... / vendor / zendframework / zendframework / library / Zend / Mvc / View / Http / DefaultRenderingStrategy.php(102):Zend \ View \ View-> render(对象(Zend \ View \ Model) \ ViewModel))#2 [内部函数]:Zend \ Mvc \ View \ Http \ DefaultRenderingStrategy-> render(对象(Zend \ Mvc \ MvcEvent))#3 / rt../vendor/zendframework /zendframework/library/Zend/EventManager/EventManager.php(468):call_user_func(Array,Object(Zend \ _ Mvc \ MvcEvent))#4 / ..../vendor/zendframework/zendframework/library /Zend/EventManager/EventManager.php(207):Zend \ EventManager \ EventManager-> triggerListeners('render.error',Object(Zend \ Mvc \ MvcEvent),Array)#5 / .........在 . / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /在第90行

这里发生了什么事? Zend为什么不为我捕获这个错误?