Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions Core/src/Exception/AbortedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,5 @@
*/
class AbortedException extends ServiceException
{
/**
* Return the delay in seconds and nanos before retrying the failed request.
*
* @return array
*/
public function getRetryDelay()
{
$metadata = array_filter($this->metadata, function ($metadataItem) {
return array_key_exists('retryDelay', $metadataItem);
});

if (count($metadata) === 0) {
return ['seconds' => 0, 'nanos' => 0];
}

return $metadata[0]['retryDelay'] + [
'seconds' => 0,
'nanos' => 0
];
}
}
20 changes: 20 additions & 0 deletions Core/src/Exception/ServiceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,26 @@ public function getReason()
return $this->errorReason;
}

/**
* Return the delay in seconds and nanos before retrying the failed request.
*
* @return array
*/
public function getRetryDelay()
{
$metadata = array_filter($this->metadata, function ($metadataItem) {
return array_key_exists('retryDelay', $metadataItem);
});

if (count($metadata) === 0) {
return ['seconds' => 0, 'nanos' => 0];
}

return $metadata[0]['retryDelay'] + [
'seconds' => 0,
'nanos' => 0
];
}

/**
* Helper to return the error info from an exception
Expand Down