Class: Google::Cloud::Storage::FileVerificationError

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

Overview

# FileVerificationError

Raised when a File download fails the verification.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#gcloud_digestObject

The value of the digest on the google-cloud file.



33
34
35
# File 'lib/google/cloud/storage/errors.rb', line 33

def gcloud_digest
  @gcloud_digest
end

#local_digestObject

The value of the digest on the downloaded file.



37
38
39
# File 'lib/google/cloud/storage/errors.rb', line 37

def local_digest
  @local_digest
end

#typeObject

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



29
30
31
# File 'lib/google/cloud/storage/errors.rb', line 29

def type
  @type
end

Class Method Details

.for_crc32c(gcloud_digest, local_digest) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/google/cloud/storage/errors.rb', line 49

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



40
41
42
43
44
45
46
# File 'lib/google/cloud/storage/errors.rb', line 40

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