GuzzleHttpPromiseRejectionException

A special exception that is thrown when waiting on a rejected promise.

Defined (1)

The class is defined in the following location(s).

/lib/Azure/GuzzleHttp/Promise/RejectionException.php  
  1. class RejectionException extends \RuntimeException 
  2. /** @var mixed Rejection reason. */ 
  3. private $reason; 
  4.  
  5. /** 
  6. * @param mixed $reason Rejection reason. 
  7. * @param string $description Optional description 
  8. */ 
  9. public function __construct($reason, $description = null) 
  10. $this->reason = $reason; 
  11.  
  12. $message = 'The promise was rejected'; 
  13.  
  14. if ($description) { 
  15. $message .= ' with reason: ' . $description; 
  16. } elseif (is_string($reason) 
  17. || (is_object($reason) && method_exists($reason, '__toString')) 
  18. ) { 
  19. $message .= ' with reason: ' . $this->reason; 
  20. } elseif ($reason instanceof \JsonSerializable) { 
  21. $message .= ' with reason: ' 
  22. . json_encode($this->reason, JSON_PRETTY_PRINT); 
  23.  
  24. parent::__construct($message); 
  25.  
  26. /** 
  27. * Returns the rejection reason. 
  28. * @return mixed 
  29. */ 
  30. public function getReason() 
  31. return $this->reason;