开发者

Why is this thrown exception duplicated?

This is a follow up question of this question, which is not really important.

I have written the following front controller plugin:

public function postDispatch(Zend_Controller_Request_Abstract $request)
{
    $response = $this->getResponse();
    $monitor = Zend_Registry::get('monitor');
    
    if ($response->isException())
    {
        $monitor->log($response);
    }
}

Where $monitor is an instance of a custom DB logging class (extending Zend_Log).

In the log method of the Monitor I loop over the Array of Zend_Exceptions returned by $response->getException().

For testing purposes I through an exception in an action:

throw new Zend_Exceptio开发者_StackOverflow社区n('the big test', 555);

Most things work as expected, the Exception is written to the database.

Question

But, it's written twice. Why?


Because the dispatch loop is called twice. First for the current action and then for default:error:error :) Place the log into dispatchLoopShutdown() method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜