Exception: Gcloud::Storage::FileVerificationError

Inherits:
Error
  • Object
show all
Defined in:
lib/gcloud/storage/errors.rb

Overview

# FileVerificationError

Raised when a File download fails the verification.

Instance Attribute Summary collapse

Attributes inherited from Error

#inner

Class Method Summary collapse

Methods inherited from Error

from_error, #initialize, klass_for

Constructor Details

This class inherits a constructor from Gcloud::Error

Instance Attribute Details

#gcloud_digestObject

The value of the digest on the Gcloud file.



72
73
74
# File 'lib/gcloud/storage/errors.rb', line 72

def gcloud_digest
  @gcloud_digest
end

#local_digestObject

The value of the digest on the downloaded file.



76
77
78
# File 'lib/gcloud/storage/errors.rb', line 76

def local_digest
  @local_digest
end

#typeObject

The type of digest that failed verification, :md5 or :crc32c.



68
69
70
# File 'lib/gcloud/storage/errors.rb', line 68

def type
  @type
end

Class Method Details

.for_crc32c(gcloud_digest, local_digest) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/gcloud/storage/errors.rb', line 88

def self.for_crc32c gcloud_digest, local_digest
  new("The downloaded file failed CRC32c verification.").tap do |e|
    e.type = :crc32c
    e.gcloud_digest = gcloud_digest
    e.local_digest = local_digest
  end
end

.for_md5(gcloud_digest, local_digest) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/gcloud/storage/errors.rb', line 79

def self.for_md5 gcloud_digest, local_digest
  new("The downloaded file failed MD5 verification.").tap do |e|
    e.type = :md5
    e.gcloud_digest = gcloud_digest
    e.local_digest = local_digest
  end
end