CakeFest 2024: The Official CakePHP Conference

Yar_Server_Exception::getType

(PECL yar >= 1.0.0)

Yar_Server_Exception::getTypeRecuperar el tipo de excepción

Descripción

public Yar_Server_Exception::getType(): string

Obtener el tipo original de la excepción lanzada por el servidor

Parámetros

Esta función no tiene parámetros.

Valores devueltos

string

Ejemplos

Ejemplo #1 Ejemplo de Yar_Server_Exception::getType()

//Server.php
<?php
class Custom_Exception extends Exception {};

class
API {
public function
throw_exception($name) {
throw new
Custom_Exception($name);
}
}

$service = new Yar_Server(new API());
$service->handle();
?>

//Client.php
<?php
$client
= new Yar_Client("http://host/api.php");

try {
$client->throw_exception("client");
} catch (
Yar_Server_Exception $e) {
var_dump($e->getType());
var_dump($e->getMessage());
}

El resultado del ejemplo sería algo similar a:

string(16) "Custom_Exception"
string(6) "client"

Ver también

add a note

User Contributed Notes

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