mirror of
https://github.com/danog/amp.git
synced 2024-12-12 17:37:34 +01:00
d48e6bd5d2
More PHP 7.1 to 8 types added.
30 lines
676 B
PHP
30 lines
676 B
PHP
<?php
|
|
|
|
namespace Amp;
|
|
|
|
class MultiReasonException extends \Exception
|
|
{
|
|
/** @var \Throwable[] */
|
|
private array $reasons;
|
|
|
|
/**
|
|
* @param \Throwable[] $reasons Array of exceptions rejecting the promise.
|
|
* @param string|null $message
|
|
*/
|
|
public function __construct(array $reasons, string $message = null)
|
|
{
|
|
parent::__construct($message ?: "Multiple errors encountered; use "
|
|
. self::class . "::getReasons() to retrieve the array of exceptions thrown");
|
|
|
|
$this->reasons = $reasons;
|
|
}
|
|
|
|
/**
|
|
* @return \Throwable[]
|
|
*/
|
|
public function getReasons(): array
|
|
{
|
|
return $this->reasons;
|
|
}
|
|
}
|