Php/docs/yar-server-exception.gettype

提供:Dev Guides
< Php
移動先:案内検索

Yar_Server_Exception::getType

(PECL yar >= 1.0.0)

Yar_Server_Exception::getTypeRetrieve exception's type


説明

public Yar_Server_Exception::getType ( ) : string

Get the exception original type threw by server


パラメータ

この関数にはパラメータはありません。


返り値

string


例1 Yar_Server_Exception::getType() example

//Server.php<?phpclass 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%22);try {    $client->throw_exception("client");} catch (Yar_Server_Exception $e) {    var_dump($e->getType());    var_dump($e->getMessage());}

上の例の出力は、 たとえば以下のようになります。


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

参考