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 164
def self.raise_if_necessary(val)
  case val
  when LibLZMA::LZMA_MEM_ERROR      then raise(self, "Couldn't allocate memory!")
  when LibLZMA::LZMA_MEMLIMIT_ERROR then raise(self, "Decoder ran out of (allowed) memory!")
  when LibLZMA::LZMA_FORMAT_ERROR   then raise(self, "Unrecognized file format!")
  when LibLZMA::LZMA_OPTIONS_ERROR  then raise(self, "Invalid options passed!")
  when LibLZMA::LZMA_DATA_ERROR     then raise(self, "Archive is currupt.")
  when LibLZMA::LZMA_BUF_ERROR      then raise(self, "Buffer unusable!")
  when LibLZMA::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