PluginProbe
Media Cloud Sync / 1.2.6
Media Cloud Sync v1.2.6
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / GuzzleHttp / Promise / RejectionException.php

RejectionException.php in Media Cloud Sync 1.2.6, at includes/sdk/s3/GuzzleHttp/Promise/RejectionException.php

41 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Promise;
4
5 /**
6 * A special exception that is thrown when waiting on a rejected promise.
7 *
8 * The reason value is available via the getReason() method.
9 */
10 class RejectionException extends \RuntimeException
11 {
12 /** @var mixed Rejection reason. */
13 private $reason;
14 /**
15 * @param mixed $reason Rejection reason.
16 * @param string $description Optional description
17 */
18 public function __construct($reason, $description = null)
19 {
20 $this->reason = $reason;
21 $message = 'The promise was rejected';
22 if ($description) {
23 $message .= ' with reason: ' . $description;
24 } elseif (\is_string($reason) || \is_object($reason) && \method_exists($reason, '__toString')) {
25 $message .= ' with reason: ' . $this->reason;
26 } elseif ($reason instanceof \JsonSerializable) {
27 $message .= ' with reason: ' . \json_encode($this->reason, \JSON_PRETTY_PRINT);
28 }
29 parent::__construct($message);
30 }
31 /**
32 * Returns the rejection reason.
33 *
34 * @return mixed
35 */
36 public function getReason()
37 {
38 return $this->reason;
39 }
40 }
41