gapic-common - Module Gapic::Rest::ResumableUpload::HasResumeHandle (v1.5.0)

Reference documentation and code samples for the gapic-common module Gapic::Rest::ResumableUpload::HasResumeHandle.

Mixin providing ResumeHandle access and uniform formatting for resumable errors.

Every error that may carry a resume handle includes this module, so it doubles as the rescue target for "this upload failed but can be retried from where it stopped":

Included by RequestFailedError, DeadlineExceededError, BadResponseError, UnseekableStreamError and StreamMismatchError.

Deliberately not included by UploadRejectedError, UploadCancelledError or SessionStateError: the first two mean the session is permanently terminated on the server and the third is a caller misuse, so none of them is retryable. Note also that resume_handle may still be nil on an including error, for instance when the failure happened before initiation established an upload URL.

Example

begin
  upload.start stream: io, upload_size: size
rescue Gapic::Rest::ResumableUpload::HasResumeHandle => e
  retry_later e.resume_handle if e.resume_handle
  raise
end

Methods

#resume_handle

def resume_handle() -> Gapic::Rest::ResumableUpload::ResumeHandle, nil
Returns
  • (Gapic::Rest::ResumableUpload::ResumeHandle, nil)