23 lines
606 B
PHP
23 lines
606 B
PHP
<?php
|
|
namespace Incoviba\Exception;
|
|
|
|
use Exception;
|
|
use Throwable;
|
|
|
|
class AggregateException extends Exception
|
|
{
|
|
public function __construct(array $exceptions, ?Throwable $previous = null)
|
|
{
|
|
$code = count($exceptions);
|
|
$temp_arr = array_reverse($exceptions);
|
|
$current = array_shift($temp_arr);
|
|
$current->previous = $previous;
|
|
foreach ($temp_arr as $exception) {
|
|
$exception->previous = $current;
|
|
$current = $exception;
|
|
}
|
|
$message = "Aggregate Exception";
|
|
parent::__construct($message, $code, $current);
|
|
}
|
|
}
|