2009年10月28日星期三

[fw-mvc] Catching Exception thrown in _forward

Hi everyone,

I have the following issue, inside an action I would like to catch the
Exception thrown inside a $this->_forward I am making.

Example code of my controller:
public function initAction()
{
$this->getFrontController()->setParam('noErrorHandler', true);
$this->getFrontController()->throwExceptions(true);
try
{
$this->_forward('test');
}
catch(Exception $e)
{
echo "CAUGHT";
exit;
}
}

public function testAction()
{
throw new Exception('TEST');
}

This code displays the exception using standard PHP display, but the "catch"
is never run.

Any idea what I am doing wrong? Or is this the excepted behavior of
_forward()?

Thanks for reading,
Cadrach
--
View this message in context: http://www.nabble.com/Catching-Exception-thrown-in-_forward-tp26098718p26098718.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: