1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-26 16:32:13 +01:00
Files
archived-doc-es/reference/errorfunc/functions/trigger-error.xml
Javier Eguiluz d8c999917f Traducida por primera vez
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@177766 c90b9560-bf6c-de11-be94-00142212c4b1
2005-01-20 17:37:23 +00:00

78 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- splitted from ./es/functions/errorfunc.xml, last change in rev 1.1 -->
<!-- last change to 'trigger-error' in en/ tree in rev 1.1 -->
<refentry id="function.trigger-error">
<refnamediv>
<refname>trigger_error</refname>
<refpurpose>
Genera un mensaje de error/aviso/notificaci&oacute;n a nivel de usuario
</refpurpose>
</refnamediv>
<refsect1>
&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>
Esta funci&oacute;n se utiliza generalmente para lanzar mensajes de error. Se puede usar
junto con el manejador de errores interno de PHP o con funciones manejadoras de error creadas
por el usuario (<function>set_error_handler</function>). Solamente funciona con la familia de
constantes E_USER y por defecto lo har&aacute; con <constant>E_USER_NOTICE</constant>.
</para>
<para>
El valor devuelto ser&aacute; &false; si se especifica un valor de <parameter>error_type</parameter> incorrecto y &true; en cualquier otro caso.
</para>
<para>
La mayor utilidad de esta funci&oacute;n es la de generar respuestas personalizadas a las excepciones en tiempo de ejecuci&oacute;n.
Por ejemplo:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
if (assert($divisor == 0)) {
trigger_error("Cannot divide by zero", E_USER_ERROR);
}
?>
]]>
</programlisting>
</informalexample>
<note>
<para>
Puede consultar la funci&oacute;n <function>set_error_handler</function> para ver un ejemplo m&acute;s extenso.
</para>
</note>
<note>
<para>
El par&aacute;metro <parameter>error_msg</parameter> tiene un l&iacute;mite de 1024 caracteres. La funci&oacute;n trunca cualquier valor superior a 1024.
</para>
</note>
</para>
<para>
Puede consultar tambi&eacute;n las funciones <function>error_reporting</function>, <function>set_error_handler</function>, <function>restore_error_handler</function> y las <link linkend="errorfunc.constants"> constantes de nivel de error</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
-->