@@ 21-47 (lines=27) @@ | ||
18 | ||
19 | namespace Surfnet\StepupMiddlewareClient\Exception; |
|
20 | ||
21 | class AccessDeniedToResourceException extends RuntimeException implements ApiErrorException |
|
22 | { |
|
23 | /** |
|
24 | * @var string[] |
|
25 | */ |
|
26 | private $errors; |
|
27 | ||
28 | /** |
|
29 | * @param string $resource |
|
30 | * @param string[] $errors |
|
31 | * @param int $code |
|
32 | * @param null|\Exception $previous |
|
33 | */ |
|
34 | public function __construct($resource, array $errors, $code = 0, \Exception $previous = null) |
|
35 | { |
|
36 | $message = sprintf("Access denied to resource '%s': are you properly authorised?", $resource); |
|
37 | ||
38 | parent::__construct($message, $code, $previous); |
|
39 | ||
40 | $this->errors = $errors; |
|
41 | } |
|
42 | ||
43 | public function getErrors() |
|
44 | { |
|
45 | return $this->errors; |
|
46 | } |
|
47 | } |
|
48 |
@@ 21-45 (lines=25) @@ | ||
18 | ||
19 | namespace Surfnet\StepupMiddlewareClient\Exception; |
|
20 | ||
21 | class ResourceReadException extends RuntimeException implements ApiErrorException |
|
22 | { |
|
23 | /** |
|
24 | * @var string[] |
|
25 | */ |
|
26 | private $errors; |
|
27 | ||
28 | /** |
|
29 | * @param string $message |
|
30 | * @param string[] $errors |
|
31 | * @param int $code |
|
32 | * @param null|\Exception $previous |
|
33 | */ |
|
34 | public function __construct($message, array $errors, $code = 0, \Exception $previous = null) |
|
35 | { |
|
36 | parent::__construct($message, $code, $previous); |
|
37 | ||
38 | $this->errors = $errors; |
|
39 | } |
|
40 | ||
41 | public function getErrors() |
|
42 | { |
|
43 | return $this->errors; |
|
44 | } |
|
45 | } |
|
46 |