Skip to content

Commit

Permalink
+ CompositeException
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmondDantes committed Sep 8, 2024
1 parent c7bdd64 commit e5146a8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/CompositeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);

namespace IfCastle\Exceptions;

class CompositeException extends LoggableException
{
public function __construct(string $message = 'Multiple exceptions occurred', \Throwable ...$exceptions)
{
$previous = null;

if(!empty($exceptions[0])) {
$previous = $exceptions[0];
}

parent::__construct([
'template' => 'Multiple exceptions occurred {context}',
'context' => $message,
'exceptions' => $exceptions,
'previous' => $previous
]);
}
}

0 comments on commit e5146a8

Please sign in to comment.