1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-30 11:02:18 +02:00
Files
archived-doc-ja/reference/errorfunc/functions/set-exception-handler.xml
TAKAGI Masahiro 12c24305dc sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@199997 c90b9560-bf6c-de11-be94-00142212c4b1
2005-11-04 22:43:59 +00:00

108 lines
3.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<!-- EN-Revision: 1.8 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi -->
<refentry id="function.set-exception-handler">
<refnamediv>
<refname>set_exception_handler</refname>
<refpurpose>
ユーザ定義の例外ハンドラ関数を設定する
</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>
例外が try/catch ブロックの中でキャッチされなかった場合の
デフォルトの例外ハンドラを設定します。
例外は、<parameter>exception_handler</parameter> がコールされた後に
停止します。
</para>
<para>
<parameter>exception_handler</parameter> は、
<function>set_exception_handler</function> をコールする前に
定義する必要があります。このハンドラ関数は、パラメータをひとつ
とる必要があります。
このパラメータは、スローされた例外オブジェクトとなります。
</para>
</refsect1>
<refsect1>
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>exception_handler</parameter></term>
<listitem>
<para>
キャッチされない例外が発生した際にコールされる関数の名前
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
前に定義された例外ハンドラの名前、またはエラー発生時に &null; を返します。
前にハンドラが定義されていない場合にも &null; が返されます。
</para>
</refsect1>
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>set_exception_handler</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
function exception_handler($exception) {
echo "Uncaught exception: " , $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>,
&seealso.callback;, &listendand;
<link linkend="language.exceptions">PHP 5 例外</link>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->