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

26 lines
598 B
PHP
Raw Normal View History

2016-08-17 22:25:54 -05:00
<?php declare(strict_types = 1);
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.
2016-05-21 09:44:52 -05:00
* @param string|null $message
*/
2016-08-11 14:35:58 -05:00
public function __construct(array $reasons, string $message = null) {
2016-11-14 13:59:21 -06:00
parent::__construct($message ?: "Too many promises were rejected");
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;
}
}