PHP Conference Ehime 2026

Yaf_Exception::__construct

(Yaf >=1.0.0)

Yaf_Exception::__constructEl propósito de __construct

Descripción

public function Yaf_Exception::__construct(string $message = "", int $code = 0)

Construye una nueva Yaf_Exception. El code lleva el código de error de Yaf que identifica el tipo de fallo, y está disponible mediante Exception::getCode().

Parámetros

message

El mensaje de la excepción.

code

El código de error de Yaf.

Valores devueltos

No se devuelve ningún valor.

Ejemplos

Ejemplo #1 Ejemplo de Yaf_Exception::__construct()

<?php
throw new Yaf_Exception(
    "Failed to find the controller 'Product'",
    YAF_ERR_NOTFOUND_CONTROLLER /* 516 */
);
?>

Resultado del ejemplo anterior es similar a:

PHP Fatal error:  Uncaught Yaf_Exception: Failed to find the controller 'Product' in /path/to/index.php:2

Véase también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top