-
Notifications
You must be signed in to change notification settings - Fork 3
/
OnExceptionEvent.php
58 lines (50 loc) · 1.37 KB
/
OnExceptionEvent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace Yoanm\JsonRpcServer\Domain\Event\Action;
use Yoanm\JsonRpcServer\Domain\Event\JsonRpcServerEvent;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
/**
* Class OnExceptionEvent
*
* Dispatched when an exception occurred during sdk execution (For method execution exception see OnMethodFailureEvent)
*/
class OnExceptionEvent implements JsonRpcServerEvent
{
const EVENT_NAME = 'json_rpc_server_skd.on_exception';
/** @var \Exception */
private $exception;
/** @var null|JsonRpcRequest */
private $fromJsonRpcRequest;
/**
* @param \Exception $exception
* @param JsonRpcRequest|null $fromJsonRpcRequest
*/
public function __construct(\Exception $exception, JsonRpcRequest $fromJsonRpcRequest = null)
{
$this->exception = $exception;
$this->fromJsonRpcRequest = $fromJsonRpcRequest;
}
/**
* @return \Exception
*/
public function getException() : \Exception
{
return $this->exception;
}
/**
* @return null|JsonRpcRequest
*/
public function getFromJsonRpcRequest() : ?JsonRpcRequest
{
return $this->fromJsonRpcRequest;
}
/**
* @param \Exception $exception
*
* @return self
*/
public function setException(\Exception $exception) : self
{
$this->exception = $exception;
return $this;
}
}