Skip to content

Commit 8811833

Browse files
author
Franciszek Wawrzak
committed
fix for saving exception previous
1 parent ed8c4e0 commit 8811833

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Model/ExceptionSieve.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ class ExceptionSieve
77
/**
88
* @param \Exception $exception
99
*/
10-
public static function saveException(\Exception $exception)
10+
public static function saveException(\Throwable $exception)
1111
{
12-
(new static())->save($exception);
12+
$sieve = new static();
13+
while ($exception !== null) {
14+
$sieve->save($exception);
15+
$exception = $exception->getPrevious();
16+
}
1317
}
1418

1519
private function getSourceName()
@@ -64,7 +68,7 @@ private function insertToDb($source, $fileName, $lineNumber, $message, $trace, $
6468
]);
6569
}
6670

67-
private function save(\Exception $exception)
71+
private function save(\Throwable $exception)
6872
{
6973
$fileName = $exception->getFile();
7074
$lineNumber = $exception->getLine();

Plugin/CatchAppExceptions.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ class CatchAppExceptions
1111
{
1212
public function aroundCatchException(AppInterface $subject, callable $proceed, Bootstrap $bootstrap, Exception $exception)
1313
{
14-
$e = $exception;
15-
do {
16-
ExceptionSieve::saveException($e);
17-
} while ($e = $e->getPrevious());
14+
ExceptionSieve::saveException($exception);
1815
return $proceed($bootstrap, $exception);
1916
}
2017
}

0 commit comments

Comments
 (0)