Yar Yar_Server_Exception::getType

(PECL yar >= 1.0.0)

Yar_Server_Exception::getType — 예외 유형 검색


설명

public Yar_Server_Exception::getType(): string

서버에서 던진 예외 원본 유형 가져오기


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

string


Examples

예제 #1 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());
}
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

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

기타