Open Journal Systems  3.3.0
RejectionException.php
1 <?php
2 namespace GuzzleHttp\Promise;
3 
9 class RejectionException extends \RuntimeException
10 {
12  private $reason;
13 
18  public function __construct($reason, $description = null)
19  {
20  $this->reason = $reason;
21 
22  $message = 'The promise was rejected';
23 
24  if ($description) {
25  $message .= ' with reason: ' . $description;
26  } elseif (is_string($reason)
27  || (is_object($reason) && method_exists($reason, '__toString'))
28  ) {
29  $message .= ' with reason: ' . $this->reason;
30  } elseif ($reason instanceof \JsonSerializable) {
31  $message .= ' with reason: '
32  . json_encode($this->reason, JSON_PRETTY_PRINT);
33  }
34 
35  parent::__construct($message);
36  }
37 
43  public function getReason()
44  {
45  return $this->reason;
46  }
47 }
GuzzleHttp\Promise\RejectionException\__construct
__construct($reason, $description=null)
Definition: RejectionException.php:21
GuzzleHttp\Promise\RejectionException\getReason
getReason()
Definition: RejectionException.php:46
GuzzleHttp\Promise\RejectionException
Definition: RejectionException.php:9
GuzzleHttp\json_encode
json_encode($value, $options=0, $depth=512)
Definition: guzzlehttp/guzzle/src/functions.php:324
GuzzleHttp\Promise
Definition: AggregateException.php:2