php-doc-en/reference/errorfunc/functions/trigger-error.xml
Damien Seguy 5abd63c92c completing the listing with and
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@130782 c90b9560-bf6c-de11-be94-00142212c4b1
2003-06-09 19:30:56 +00:00

78 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/errorfunc.xml, last change in rev 1.1 -->
<refentry id="function.trigger-error">
<refnamediv>
<refname>trigger_error</refname>
<refpurpose>
Generates a user-level error/warning/notice message
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>trigger_error</methodname>
<methodparam><type>string</type><parameter>error_msg</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>error_type</parameter></methodparam>
</methodsynopsis>
<para>
Used to trigger a user error condition, it can be used by in conjunction
with the built-in error handler, or with a user defined function that has
been set as the new error handler
(<function>set_error_handler</function>). It only works with the E_USER
family of constants, and will default to <constant>E_USER_NOTICE</constant>.
</para>
<para>
This function is useful when
you need to generate a particular response to an exception at runtime.
For example:
<informalexample>
<programlisting>
<![CDATA[
if (assert ($divisor == 0)) {
trigger_error ("Cannot divide by zero", E_USER_ERROR);
}
]]>
</programlisting>
</informalexample>
<note>
<para>
See <function>set_error_handler</function> for a more extensive example.
</para>
</note>
<note>
<para>
<parameter>error_msg</parameter> is limited to 1024 characters in length.
Any additional characters beyond 1024 will be truncated.
</para>
</note>
</para>
<para>
See also <function>error_reporting</function>,
<function>set_error_handler</function>,
<function>restore_error_handler</function>, and
<function>user_error</function>.
</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
-->