update docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@327671 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Xinchen Hui 2012-09-17 08:48:13 +00:00
parent 0794362fa2
commit ff8bbeed9c
3 changed files with 96 additions and 17 deletions

View file

@ -20,12 +20,9 @@
</para>
<para>
then if you enable <methodname>Yaf_Dispatcher::catchException</methodname>(also can enabled by set
application.dispatcher.catchException), all Un-caught Exceptions will be
caught by ErrorController::error if you have defined one.
<link linkend="configuration.yaf.dispatcher.catchexception">application.dispatcher.catchException</link>),
all uncaught Exceptions will be caught by ErrorController::error if you have defined one.
</para>
</refsect1>
<refsect1 role="parameters">
@ -35,7 +32,7 @@
<term><parameter>flag</parameter></term>
<listitem>
<para>
bool
</para>
</listitem>
</varlistentry>
@ -95,6 +92,7 @@ class ErrorController extends Yaf_Controller_Abstract {
&reftitle.seealso;
<simplelist>
<member><methodname>Yaf_Dispatcher::throwException</methodname></member>
<member><methodname>Yaf_Dispatcher::setErrorHandler</methodname></member>
</simplelist>
</refsect1>

View file

@ -4,7 +4,7 @@
<refentry xml:id="yaf-dispatcher.seterrorhandler" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Dispatcher::setErrorHandler</refname>
<refpurpose>The setErrorHandler purpose</refpurpose>
<refpurpose>Set error handler</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -15,11 +15,13 @@
<methodparam><type>int</type><parameter>error_types</parameter></methodparam>
</methodsynopsis>
<para>
Set error handler for Yaf. when <link
linkend="configuration.yaf.dispatcher.throwexception">application.dispatcher.throwException</link>
is off, Yaf will trigger catchable error while unexpected errors occrred.
</para>
<para>
Thus, this error handler will be called while the error raise.
</para>
</refsect1>
<refsect1 role="parameters">
@ -29,7 +31,7 @@
<term><parameter>callback</parameter></term>
<listitem>
<para>
A callable callback
</para>
</listitem>
</varlistentry>
@ -51,6 +53,14 @@
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Yaf_Dispatcher::throwException</methodname></member>
<member><methodname>Yaf_Application::getLastErrorNo</methodname></member>
<member><methodname>Yaf_Application::getLastErrorMsg</methodname></member>
</simplelist>
</refsect1>
</refentry>

View file

@ -14,11 +14,15 @@
<methodparam choice="opt"><type>bool</type><parameter>flag</parameter></methodparam>
</methodsynopsis>
<para>
Siwtch on/off exception throwing while unexpected error occurring.
When this is on, Yaf will throwing exceptions instead of triggering
catchable errors.
</para>
<para>
You can also use <link linkend="configuration.yaf.dispatcher.throwexception">
application.dispatcher.throwException</link> to achieve the
same purpose.
</para>
</refsect1>
<refsect1 role="parameters">
@ -28,7 +32,7 @@
<term><parameter>flag</parameter></term>
<listitem>
<para>
bool
</para>
</listitem>
</varlistentry>
@ -42,6 +46,73 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Dispatcher::throwexception</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$config = array(
'application' => array(
'directory' => dirname(__FILE__),
),
);
$app = new Yaf_Application($config);
$app->getDispatcher()->throwException(true);
try {
$app->run();
} catch (Yaf_Exception $e) {
var_dump($e->getMessage());
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(59) "Could not find controller script /tmp/controllers/Index.php"
]]>
</screen>
</example>
<example>
<title><function>Yaf_Dispatcher::throwexception</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$config = array(
'application' => array(
'directory' => dirname(__FILE__),
),
);
$app = new Yaf_Application($config);
$app->getDispatcher()->throwException(false);
$app->run();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
PHP Catchable fatal error: Yaf_Application::run(): Could not find controller script /tmp/controllers/Index.php in /tmp/1.php on line 12
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Yaf_Dispatcher::catchException</methodname></member>
<member><classname>Yaf_Exception</classname></member>
</simplelist>
</refsect1>
</refentry>