Module: Liberic::Helpers::Invocation

Extended by:
Invocation
Included in:
Invocation
Defined in:
lib/liberic/helpers/invocation.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#raise_on_error(value) ⇒ Object

Raises:



9
10
11
12
# File 'lib/liberic/helpers/invocation.rb', line 9

def raise_on_error(value)
  return value if value == SDK::Fehlercodes::ERIC_OK
  raise Error.new(SDK::Fehlercodes::CODES[value])
end

#with_result_buffer(raise_on_error = true, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/liberic/helpers/invocation.rb', line 14

def with_result_buffer(raise_on_error = true, &block)
  handle = SDK::API.rueckgabepuffer_erzeugen
  if raise_on_error
    raise_on_error(yield(handle))
  else
    yield(handle)
  end
  result = Liberic::SDK::API.rueckgabepuffer_inhalt(handle)
  SDK::API.rueckgabepuffer_freigeben(handle)
  result
end