File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Aternos \IO \Interfaces \IOElementInterface ;
6
6
use Exception ;
7
+ use Throwable ;
7
8
8
9
/**
9
10
* Class IOException
@@ -17,10 +18,15 @@ class IOException extends Exception
17
18
/**
18
19
* @param string $message
19
20
* @param IOElementInterface|null $element
21
+ * @param Throwable|null $previous
20
22
*/
21
- public function __construct (string $ message = "" , protected IOElementInterface |null $ element = null )
23
+ public function __construct (
24
+ string $ message = "" ,
25
+ protected IOElementInterface |null $ element = null ,
26
+ ?Throwable $ previous = null
27
+ )
22
28
{
23
- parent ::__construct ($ message );
29
+ parent ::__construct ($ message, previous: $ previous );
24
30
}
25
31
26
32
/**
@@ -30,4 +36,4 @@ public function getIOElement(): ?IOElementInterface
30
36
{
31
37
return $ this ->element ;
32
38
}
33
- }
39
+ }
Original file line number Diff line number Diff line change @@ -20,4 +20,11 @@ public function testGetElement(): void
20
20
$ exception = new IOException ("test " , $ element );
21
21
$ this ->assertSame ($ element , $ exception ->getIOElement ());
22
22
}
23
- }
23
+
24
+ public function testGetPrevious (): void
25
+ {
26
+ $ previous = new \Exception ("previous " );
27
+ $ exception = new IOException ("test " , null , $ previous );
28
+ $ this ->assertSame ($ previous , $ exception ->getPrevious ());
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments