PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 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 All 36 releases
← All changes | includes/sdk/s3/Aws/Exception/AwsException.php +16 -15 1.2.6 → 1.4.2 View file →
@@ -11,8 +11,9 @@
11 11 use Dudlewebs\WPMCS\s3\Aws\ResultInterface;
12 12 use Dudlewebs\WPMCS\s3\JmesPath\Env as JmesPath;
13 13 use Dudlewebs\WPMCS\s3\Psr\Http\Message\ResponseInterface;
14 14 use Dudlewebs\WPMCS\s3\Psr\Http\Message\RequestInterface;
15 +use Throwable;
15 16 /**
16 17 * Represents an AWS exception that is thrown when a command fails.
17 18 */
18 19 class AwsException extends \RuntimeException implements MonitoringEventsInterface, ResponseContainerInterface, \ArrayAccess
@@ -32,27 +33,27 @@
32 33 private $transferInfo;
33 34 private $errorMessage;
34 35 private $maxRetriesExceeded;
35 36 /**
36 - * @param string $message Exception message
37 + * @param string $message Exception message
37 38 * @param CommandInterface $command
38 - * @param array $context Exception context
39 - * @param \Exception $previous Previous exception (if any)
39 + * @param array $context Exception context
40 + * @param Throwable|null $previous Previous exception (if any)
40 41 */
41 - public function __construct($message, CommandInterface $command, array $context = [], \Exception $previous = null)
42 + public function __construct($message, CommandInterface $command, array $context = [], ?Throwable $previous = null)
42 43 {
43 - $this->data = isset($context['body']) ? $context['body'] : [];
44 + $this->data = $context['body'] ?? [];
44 45 $this->command = $command;
45 - $this->response = isset($context['response']) ? $context['response'] : null;
46 - $this->request = isset($context['request']) ? $context['request'] : null;
47 - $this->requestId = isset($context['request_id']) ? $context['request_id'] : null;
48 - $this->errorType = isset($context['type']) ? $context['type'] : null;
49 - $this->errorCode = isset($context['code']) ? $context['code'] : null;
50 - $this->errorShape = isset($context['error_shape']) ? $context['error_shape'] : null;
46 + $this->response = $context['response'] ?? null;
47 + $this->request = $context['request'] ?? null;
48 + $this->requestId = $context['request_id'] ?? null;
49 + $this->errorType = $context['type'] ?? null;
50 + $this->errorCode = $context['code'] ?? null;
51 + $this->errorShape = $context['error_shape'] ?? null;
51 52 $this->connectionError = !empty($context['connection_error']);
52 - $this->result = isset($context['result']) ? $context['result'] : null;
53 - $this->transferInfo = isset($context['transfer_stats']) ? $context['transfer_stats'] : [];
54 - $this->errorMessage = isset($context['message']) ? $context['message'] : null;
53 + $this->result = $context['result'] ?? null;
54 + $this->transferInfo = $context['transfer_stats'] ?? [];
55 + $this->errorMessage = $context['message'] ?? null;
55 56 $this->monitoringEvents = [];
56 57 $this->maxRetriesExceeded = \false;
57 58 parent::__construct($message, 0, $previous);
58 59 }
@@ -183,9 +184,9 @@
183 184 {
184 185 if (!$name) {
185 186 return $this->transferInfo;
186 187 }
187 - return isset($this->transferInfo[$name]) ? $this->transferInfo[$name] : null;
188 + return $this->transferInfo[$name] ?? null;
188 189 }
189 190 /**
190 191 * Replace the transfer information associated with an exception.
191 192 *