Update Yar_Server_Exception

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332246 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Xinchen Hui 2013-12-03 08:38:47 +00:00
parent 26fa02c469
commit d4c19dd8ff
2 changed files with 27 additions and 9 deletions

View file

@ -12,7 +12,8 @@
<section xml:id="yar-server-exception.intro">
&reftitle.intro;
<para>
If service threw exceptions, A Yar_Server_Exception will be threw in
client side.
</para>
</section>
<!-- }}} -->

View file

@ -10,15 +10,12 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Yar_Server_Exception::getType</methodname>
<modifier>public</modifier> <type>string</type><methodname>Yar_Server_Exception::getType</methodname>
<void />
</methodsynopsis>
<para>
Get the exception original type threw by server
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,7 +26,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
string
</para>
</refsect1>
@ -39,17 +36,37 @@
<title><function>Yar_Server_Exception::getType</function> example</title>
<programlisting role="php">
<![CDATA[
//Server.php
<?php
class Custom_Exception extends Exception {};
/* ... */
class API {
public function throw_exception($name) {
throw new Custom_Exception($name);
}
}
$service = new Yar_Server(new API());
$service->handle();
?>
//Client.php
<?php
$client = new Yar_Client("http://host/api.php");
try {
$client->throw_exception("client");
} catch (Yar_Server_Exception $e) {
var_dump($e->getType());
var_dump($e->getMessage());
}
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
string(16) "Custom_Exception"
string(6) "client"
]]>
</screen>
</example>