Exception: XZ::LZMAError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/xz/lib_lzma.rb

Overview

The class of the error that this library raises.

Class Method Summary collapse

Class Method Details

.raise_if_necessary(val) ⇒ Object

Raises an appropriate exception if val isn’t a liblzma success code.



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/xz/lib_lzma.rb', line 97

def self.raise_if_necessary(val)
  case LibLZMA::LZMA_RET[val]
  when :lzma_mem_error      then raise(self, "Couldn't allocate memory!")
  when :lzma_memlimit_error then raise(self, "Decoder ran out of (allowed) memory!")
  when :lzma_format_error   then raise(self, "Unrecognized file format!")
  when :lzma_options_error  then raise(self, "Invalid options passed!")
  when :lzma_data_error     then raise(self, "Archive is currupt.")
  when :lzma_buf_error      then raise(self, "Buffer unusable!")
  when :lzma_prog_error     then raise(self, "Program error--if you're sure your code is correct, you may have found a bug in liblzma.")
  end
end