2021-05-24 01:24:22 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-08-15 06:00:27 +08:00
|
|
|
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
|
2019-12-29 21:43:14 +08:00
|
|
|
class DecompressionError < Error; end
|
2021-11-27 19:02:29 +08:00
|
|
|
|
|
|
|
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
|
2021-11-29 00:51:06 +08:00
|
|
|
|
2022-08-14 18:30:43 +08:00
|
|
|
class SplitArchiveError < Error
|
|
|
|
def message
|
|
|
|
'Rubyzip cannot extract from split archives at this time.'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-11-29 00:51:06 +08:00
|
|
|
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
|
2013-08-15 06:00:27 +08:00
|
|
|
end
|