for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Yiisoft\ErrorHandler;
use Exception;
use Throwable;
/**
* Aggregate multiple exceptions into one.
*/
final class CompositeException extends Exception
{
* @var Throwable[]
public array $rest;
public function __construct(
private Throwable $first,
Throwable ...$rest,
) {
$this->rest = $rest;
* @psalm-suppress PossiblyInvalidArgument
parent::__construct($first->getMessage(), $first->getCode(), $first);
}
public function getFirstException(): Throwable
return $this->first;
* @return Throwable[]
public function getPreviousExceptions(): array
return $this->rest;