forked from evaisse/SimpleHttpBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseException.php
More file actions
63 lines (53 loc) · 1.45 KB
/
ResponseException.php
File metadata and controls
63 lines (53 loc) · 1.45 KB
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
59
60
61
62
63
<?php
/**
* Created by PhpStorm.
* User: evaisse
* Date: 29/05/15
* Time: 20:38
*/
namespace evaisse\SimpleHttpBundle\Http\Exception;
use evaisse\SimpleHttpBundle\Http\Response;
use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
class ResponseException extends HttpException
{
/**
* $response : Response object if provided
*
* @var ServiceResponse
* @access protected
*/
protected $response;
/**
* Create a response exception
*
* @param Response $response response attached to error
* @param string $message Message describing exception
* @param int $code error code
* @param Exception|null $previous optionnal previous exception
*/
public function __construct(Response $response, $message = "", $code = 0, ?Exception $previous = null)
{
parent::__construct(580, $message, $previous, [], $code); // TODO: Change the autogenerated stub
$this->setResponse($response);
}
/**
* Set value for $response
*
* @param Response $value value to set to response
* @return Object instance for method chaining
*/
protected function setResponse(Response $value)
{
$this->response = $value;
return $this;
}
/**
* Get value for $response
* @return ServiceResponse Response object if provided
*/
public function getResponse()
{
return $this->response;
}
}