class XZ::LZMAError

The class of the error that this library raises.

Public Class Methods

raise_if_necessary(val) click to toggle source

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

# File lib/xz/lib_lzma.rb, line 96
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