mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
New documentation in new format.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@167280 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3634432d89
commit
3b39595fab
1 changed files with 93 additions and 26 deletions
|
@ -1,32 +1,99 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.set-exception-handler">
|
||||
<refnamediv>
|
||||
<refname>set_exception_handler</refname>
|
||||
<refpurpose>
|
||||
Sets a user-defined exception handler function
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>set_exception_handler</methodname>
|
||||
<methodparam><type>callback</type><parameter>exception_handler</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the previously defined exception handler, or &false; on error.
|
||||
</para>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.set-exception-handler">
|
||||
<refnamediv>
|
||||
<refname>set_exception_handler</refname>
|
||||
<refpurpose>
|
||||
Sets a user-defined exception handler function
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>set_exception_handler</methodname>
|
||||
<methodparam><type>callback</type><parameter>exception_handler</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Sets the default exception handler if an exception is not caught within a
|
||||
try/catch block. Execution will stop after the
|
||||
<parameter>exception_handler</parameter> is called.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>exception_handler</parameter> must be defined before calling
|
||||
<function>set_exception_handler</function>. This function needs to accept
|
||||
one parameter, which will be the exception object that was thrown.
|
||||
<methodsynopsis>
|
||||
<methodname><replaceable>exception_handler</replaceable></methodname>
|
||||
<methodparam><type>object</type><parameter>exception</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>exception</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of function to be called when an uncaught exception occurs.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>exception_handler</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of function to be called when an uncaught exception occurs.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the previously defined exception handler, or &false; on error. If
|
||||
no previous handler was defined, an empty string is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
&warn.undocumented.func;
|
||||
function exception_handler($exception) {
|
||||
|
||||
<para>
|
||||
See also
|
||||
<function>restore_exception_handler</function>,
|
||||
<function>restore_error_handler</function>, and
|
||||
<function>error_reporting</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
echo "Uncaught excepction: " , $exception->getMessage(), "\n";
|
||||
|
||||
}
|
||||
|
||||
set_exception_handler('exception_handler');
|
||||
|
||||
|
||||
throw new Exception('Uncaught Exception');
|
||||
echo "Not Executed\n";
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<function>restore_exception_handler</function>
|
||||
<function>restore_error_handler</function>
|
||||
<function>error_reporting</function>&listendand;
|
||||
<link linkend="language.oop5.exceptions">PHP5 Exceptions</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
Loading…
Reference in a new issue