Exception: WmiLite::WmiException

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/wmi-lite/wmi_exception.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception, wmi_method_context, namespace, query = nil, class_name = nil) ⇒ WmiException

Returns a new instance of WmiException.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wmi-lite/wmi_exception.rb', line 21

def initialize(exception, wmi_method_context, namespace, query = nil, class_name = nil)
  error_message = exception.message
  error_code = translate_error_code(error_message)

  case wmi_method_context
  when :ConnectServer
    error_message = translate_wmi_connect_error_message(error_message, error_code, namespace)
  when :ExecQuery
    error_message = translate_query_error_message(error_message, error_code, namespace, query, class_name)
  end

  super(error_message)
end