<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- 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 role="description">
  &reftitle.description;
  <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>). 
  </para>
  <para>
   This function is useful when you need to generate a particular response to
   an exception at runtime.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>error_msg</parameter></term>
     <listitem>
      <para>
       The designated error message for this error. It's limited to 1024 
       characters in length. Any additional characters beyond 1024 will be 
       truncated.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>error_type</parameter></term>
     <listitem>
      <para>
       The designated error type for this error. It only works with the E_USER
       family of constants, and will default to <constant>E_USER_NOTICE</constant>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   This function returns &false; if wrong <parameter>error_type</parameter> is
   specified, &true; otherwise.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>trigger_error</function> example</title>
    <para>
     See <function>set_error_handler</function> for a more extensive example.
    </para>
    <programlisting role="php">
<![CDATA[
<?php
if (assert($divisor == 0)) {
    trigger_error("Cannot divide by zero", E_USER_ERROR);
}
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>error_reporting</function></member>
    <member><function>set_error_handler</function></member>
    <member><function>restore_error_handler</function></member>
    <member>The <link linkend="errorfunc.constants">error level constants</link></member>
   </simplelist>
  </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
-->