(Yaf >=1.0.0)
Yaf_Dispatcher::catchException — ����/�ر��Զ��쳣������
�� application.dispatcher.throwException ������ʱ����Ҳ����ͨ������ Yaf_Dispatcher::throwException(TRUE)() ������������Yaf�����׳��쳣�����Ǵ����쳣������
��������� Yaf_Dispatcher::catchException() ������ͨ������application.dispatcher.catchException�����������������㶨�����쳣�����controller������£�Yaf�Ὣ����δ������쳣����Error Controller��Error Action������
flag
bool
Example #1 Yaf_Dispatcher::catchException()example
/* if you defined a ErrorController like following */
<?php
class ErrorController extends Yaf_Controller_Abstract {
/**
* you can also call to Yaf_Request_Abstract::getException to get the
* un-caught exception.
*/
public function error($exception) {
/* error occurs */
switch ($exception->getCode()) {
case YAF_ERR_NOTFOUND_MODULE:
case YAF_ERR_NOTFOUND_CONTROLLER:
case YAF_ERR_NOTFOUND_ACTION:
case YAF_ERR_NOTFOUND_VIEW:
echo 404, ":", $exception->getMessage();
break;
default :
$message = $exception->getMessage();
echo 0, ":", $exception->getMessage();
break;
}
}
}
?>
�������̵���������ڣ�
/* now if some error occur, assuming access a non-exists controller(or you can throw a exception yourself): */ 404:Could not find controller script **/application/controllers/No-exists-controller.php