CircuitBreakerException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getException() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tleckie\CircuitBreaker\Exception;
6
7
use Exception;
8
use Throwable;
9
10
/**
11
 * Class UnavailableServiceException
12
 * @package Tleckie\CircuitBreaker
13
 */
14
class CircuitBreakerException extends Exception
15
{
16
    /**
17
     * @var Throwable
18
     */
19
    protected Throwable $exception;
20
21
    /**
22
     * CircuitBreakerException constructor.
23
     * @param Throwable $exception
24
     */
25
    public function __construct(Throwable $exception)
26
    {
27
        parent::__construct($exception->getMessage(), $exception->getCode(), $exception);
28
29
        $this->exception = $exception;
30
    }
31
32
    /**
33
     * @return Throwable
34
     */
35
    public function getException(): Throwable
36
    {
37
        return $this->exception;
38
    }
39
}
40