首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Yar_Server_Exception::getType

(PECL yar >= 1.0.0)

Yar_Server_Exception::getType — The getType purpose

Description

代码语言:javascript
复制
public string Yar_Server_Exception::getType ( void )

Get the exception original type threw by server

Parameters

This function has no parameters.

Return Values

string

Examples

Example #1 Yar_Server_Exception::getType() example

代码语言:javascript
复制
//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());
}

The above example will output something similar to:

代码语言:javascript
复制
string(16) "Custom_Exception"
string(6) "client"

See Also

← Yar_Server_Exception

Yar_Client_Exception →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券