rubyzip/lib/zip/errors.rb

46 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
module Zip
2014-01-24 17:37:38 +08:00
class Error < StandardError; end
class EntryExistsError < Error; end
class DestinationFileExistsError < Error; end
class EntryNameError < Error; end
2019-09-13 05:01:38 +08:00
class EntrySizeError < Error; end
2014-01-24 17:37:38 +08:00
class InternalError < Error; end
class DecompressionError < Error; end
class CompressionMethodError < Error
attr_reader :compression_method
def initialize(method)
super()
@compression_method = method
end
def message
"Unsupported compression method: #{COMPRESSION_METHODS[@compression_method]}."
end
end
class SplitArchiveError < Error
def message
'Rubyzip cannot extract from split archives at this time.'
end
end
class StreamingError < Error
attr_reader :entry
def initialize(entry)
super()
@entry = entry
end
def message
"The local header of this entry ('#{@entry.name}') does not contain " \
'the correct metadata for `Zip::InputStream` to be able to ' \
'uncompress it. Please use `Zip::File` instead of `Zip::InputStream`.'
end
end
end