Module: LLDB::Native

Defined in:
lib/lldb/native.rb

Class Method Summary collapse

Class Method Details

.check_error!(operation, error) ⇒ Object

RBS:

  • operation: String

  • error: Error

  • return: true

Raises:



30
31
32
33
34
# File 'lib/lldb/native.rb', line 30

def self.check_error!(operation, error)
  raise OperationError.new(operation, error) if error.fail?

  true
end

.check_status!(status, operation, error = nil) ⇒ Object

RBS:

  • status: Integer

  • operation: String

  • error: Error?

  • return: bool

Raises:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lldb/native.rb', line 11

def self.check_status!(status, operation, error = nil)
  return true if status == NativeStatus::OK

  if status == NativeStatus::INTERNAL_ERROR
    message = FFIBindings.lldb_wrapper_last_error_message || 'unknown native exception'
    code = FFIBindings.lldb_wrapper_last_error_code
    raise InternalBindingError.new(operation, message, code)
  end

  native_error = error || Error.new
  unless native_error.fail?
    native_error.set_error("native operation failed with status #{status}")
  end
  raise OperationError.new(operation, native_error)
end