Exception: XZ::LZMAError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/xz.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.



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/xz.rb', line 94

def self.raise_if_necessary(val)
  case 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 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