Exception: HawatelPS::Windows::WmiCliException

Inherits:
Exception
  • Object
show all
Defined in:
lib/hawatel_ps/windows/wmi/wmi_exception.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {:exception => nil, :message => nil}) ⇒ void

Custom exception

Parameters:

  • args (Hash) (defaults to: {:exception => nil, :message => nil})

    the options to create a custom exception message

  • :exception (Hash)

    a customizable set of options

  • :message (Hash)

    a customizable set of options



9
10
11
# File 'lib/hawatel_ps/windows/wmi/wmi_exception.rb', line 9

def initialize(args = {:exception => nil, :message => nil})
  super(exception_enrichment(args))
end

Instance Method Details

#exception_enrichment(args) ⇒ Object (private)



14
15
16
17
18
19
20
# File 'lib/hawatel_ps/windows/wmi/wmi_exception.rb', line 14

def exception_enrichment(args)
  error_message = ''
  error_message += args[:message] unless args[:message].nil?
  error_message +=
      "\nNative exception from '#{args[:exception].class}':\n#{args[:exception].message}" unless args[:exception].nil?
  return error_message
end