1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00
amp/lib/MultiReasonException.php

29 lines
576 B
PHP
Raw Normal View History

<?php
2016-08-15 23:46:26 -05:00
2016-05-24 10:39:19 -05:00
namespace Amp;
2016-05-21 09:44:52 -05:00
2018-06-18 20:00:01 +02:00
class MultiReasonException extends \Exception
{
2016-08-17 22:25:54 -05:00
/** @var \Throwable[] */
2016-05-21 09:44:52 -05:00
private $reasons;
/**
2016-11-14 13:59:21 -06:00
* @param \Throwable[] $reasons Array of exceptions rejecting the promise.
* @param string|null $message
2016-05-21 09:44:52 -05:00
*/
2018-06-18 20:00:01 +02:00
public function __construct(array $reasons, string $message = null)
{
2016-12-09 11:54:34 -05:00
parent::__construct($message ?: "Multiple errors encountered");
2016-05-21 09:44:52 -05:00
$this->reasons = $reasons;
}
/**
2016-08-11 14:35:58 -05:00
* @return \Throwable[]
2016-05-21 09:44:52 -05:00
*/
2018-06-18 20:00:01 +02:00
public function getReasons(): array
{
2016-05-21 09:44:52 -05:00
return $this->reasons;
}
}