Module: Sigma::Util

Extended by:
FFI::Library
Defined in:
lib/sigma/util.rb

Defined Under Namespace

Classes: ErgoError

Class Method Summary collapse

Class Method Details

.check_error!(error_pointer) ⇒ Object

Raises:



16
17
18
19
20
21
22
23
24
# File 'lib/sigma/util.rb', line 16

def self.check_error!(error_pointer)
  return if error_pointer.null?

  c_reason_ptr = ergo_lib_error_to_string(error_pointer)
  reason = c_reason_ptr.read_string
  ergo_lib_delete_string(c_reason_ptr)
  ergo_lib_delete_error(error_pointer)
  raise ErgoError.new(reason: reason)
end