Sha256: b333709bfb7fdc55b68e8a10f6a7c454f25d10f5f1e19f1ac9db90a4419d6cb4

Contents?: true

Size: 1.97 KB

Versions: 26

Compression:

Stored size: 1.97 KB

Contents

# Copyright 2014 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


require "google/cloud/errors"

module Google
  module Cloud
    module Storage
      ##
      # # FileVerificationError
      #
      # Raised when a File download fails the verification.
      class FileVerificationError < Google::Cloud::Error
        ##
        # The type of digest that failed verification,
        # :md5 or :crc32c.
        attr_accessor :type

        ##
        # The value of the digest on the google-cloud file.
        attr_accessor :gcloud_digest

        ##
        # The value of the digest on the downloaded file.
        attr_accessor :local_digest

        # @private
        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

        # @private
        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
      end

      ##
      # # SignedUrlUnavailable Error
      #
      # This is raised when File#signed_url is unable to generate a URL due to
      # missing credentials needed to create the URL.
      class SignedUrlUnavailable < Google::Cloud::Error
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
google-cloud-storage-1.26.2 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.26.1 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.26.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.25.1 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.25.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.24.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.23.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.22.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.21.1 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.21.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.20.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.19.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.18.2 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.18.1 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.18.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.17.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.16.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.15.0 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.14.2 lib/google/cloud/storage/errors.rb
google-cloud-storage-1.14.1 lib/google/cloud/storage/errors.rb