-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOnMethodFailureEvent.php
53 lines (45 loc) · 1.2 KB
/
OnMethodFailureEvent.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
<?php
namespace Yoanm\JsonRpcServer\Domain\Event\Action;
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodInterface;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
/**
* Class OnMethodFailureEvent
*
* Dispatched only in case JSON-RPC method throw an exception during execution
*/
class OnMethodFailureEvent extends AbstractOnMethodEvent
{
const EVENT_NAME = 'json_rpc_server_skd.on_method_failure';
/** @var \Exception */
private $exception;
/**
* @param \Exception $exception
* @param JsonRpcMethodInterface $method
* @param JsonRpcRequest $jsonRpcRequest
*/
public function __construct(
\Exception $exception,
JsonRpcMethodInterface $method,
JsonRpcRequest $jsonRpcRequest
) {
$this->exception = $exception;
parent::__construct($method, $jsonRpcRequest);
}
/**
* @return \Exception
*/
public function getException() : \Exception
{
return $this->exception;
}
/**
* @param \Exception $exception
*
* @return self
*/
public function setException(\Exception $exception) : self
{
$this->exception = $exception;
return $this;
}
}