PHP 8.5.0 Alpha 1 available for testing

Yar_Server_Exception::getType

(PECL yar >= 1.0.0)

Yar_Server_Exception::getTypeRetrieve exception's type

Description

public Yar_Server_Exception::getType(): string

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

/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:

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

See Also

add a note

User Contributed Notes

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant