<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- 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>bool</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 returns &false; if wrong <parameter>error_type</parameter> is
     specified, &true; otherwise.
    </para>
    <para>
     This function is useful when
     you need to generate a particular response to an exception at runtime.
     For example:
     <informalexample>
      <programlisting role="php">
<![CDATA[
<?php
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
     <link linkend="errorfunc.constants">error level constants</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
-->