Exception: Openwsman::Exception

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/wbem/openwsman.rb

Overview

Capture Fault as Exception

Instance Method Summary collapse

Constructor Details

#initialize(fault) ⇒ Exception

Returns a new instance of Exception.



16
17
18
19
20
21
22
# File 'lib/wbem/openwsman.rb', line 16

def initialize fault
  unless fault.is_a? Openwsman::Fault
    raise "#{fault} is not a fault" unless fault.fault?
    fault = Openwsman::Fault.new fault
  end
  @fault = fault
end

Instance Method Details

#to_sObject



23
24
25
26
27
# File 'lib/wbem/openwsman.rb', line 23

def to_s
  "Fault code #{@fault.code}, subcode #{@fault.subcode}" +
  "\n\treason \"#{@fault.reason}\"" +
  "\n\tdetail \"#{@fault.detail}\""
end