當我在Action Helper中拋出一個異常(例如throw new Zend_Exception('You are not allowed',403);
)時,ErrorHandler將無法捕捉它。我得到了Fatal error: Uncaught exception 'Zend_Exception' with message 'You are not allowed' in..
。如何在動作助手中捕捉異常?
我也在frontController中設置了throwExceptions = false。
如何在Action Controller中捕獲異常?
將throwExceptions設置爲false意味着Zend Framework本身不會拋出異常。您的代碼特別拋出的異常不會受到影響。 – 2011-06-12 19:16:08
你是否拋出異常來表示這是一個HTTP狀態403禁止的整個請求? – hakre 2011-06-12 19:20:23