2016-12-29 14:09:49 -06:00
|
|
|
<?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
|
|
|
|
|
|
|
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.
|
2017-03-10 21:58:46 +01:00
|
|
|
* @param string|null $message
|
2016-05-21 09:44:52 -05:00
|
|
|
*/
|
2016-08-11 14:35:58 -05: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
|
|
|
*/
|
2016-08-11 14:35:58 -05:00
|
|
|
public function getReasons(): array {
|
2016-05-21 09:44:52 -05:00
|
|
|
return $this->reasons;
|
|
|
|
}
|
|
|
|
}
|