curt Wed Aug 25 22:28:16 2004 EDT
Modified files: /phpdoc/en/reference/errorfunc/functions set-exception-handler.xml Log: New documentation in new format. http://cvs.php.net/diff.php/phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml diff -u phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml:1.1 phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml:1.2 --- phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml:1.1 Sat Jul 24 02:35:11 2004 +++ phpdoc/en/reference/errorfunc/functions/set-exception-handler.xml Wed Aug 25 22:28:16 2004 @@ -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> - - &warn.undocumented.func; - - <para> - See also - <function>restore_exception_handler</function>, - <function>restore_error_handler</function>, and - <function>error_reporting</function>. - </para> - </refsect1> - </refentry> +<!-- $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 + +function exception_handler($exception) { + + 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: