Skip to content

Commit 27987d0

Browse files
wb-hx510875AxiosLeo
authored andcommitted
Supported $_lastException variable
1 parent 243315c commit 27987d0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/ImageSearch.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ public function _request($action, $protocol, $method, $request, RuntimeOptions $
122122
],
123123
'ignoreSSL' => $runtime->ignoreSSL,
124124
];
125-
$_lastRequest = null;
126-
$_now = time();
127-
$_retryTimes = 0;
125+
$_lastRequest = null;
126+
$_lastException = null;
127+
$_now = time();
128+
$_retryTimes = 0;
128129
while (Tea::allowRetry($_runtime['retry'], $_retryTimes, $_now)) {
129130
if ($_retryTimes > 0) {
130131
$_backoffTime = Tea::getBackoffTime($_runtime['backoff'], $_retryTimes);
@@ -171,15 +172,17 @@ public function _request($action, $protocol, $method, $request, RuntimeOptions $
171172

172173
return $body;
173174
} catch (\Exception $e) {
174-
if (Tea::isRetryable($_runtime['retry'], $_retryTimes)) {
175+
if (Tea::isRetryable($e)) {
176+
$_lastException = $e;
177+
175178
continue;
176179
}
177180

178181
throw $e;
179182
}
180183
}
181184

182-
throw new TeaUnableRetryError($_lastRequest);
185+
throw new TeaUnableRetryError($_lastRequest, $_lastException);
183186
}
184187

185188
/**

0 commit comments

Comments
 (0)