Method: Puppet::Util::Windows::COM.raise_if_hresult_failed

Defined in:
lib/puppet/util/windows/com.rb

.raise_if_hresult_failed(name, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
# File 'lib/puppet/util/windows/com.rb', line 16

def raise_if_hresult_failed(name, *args)
  failed = FAILED(result = send(name, *args)) and raise _("%{name} failed (hresult %{result}).") % { name: name, result: format('%#08x', result) }

  result
ensure
  yield failed if block_given?
end