Exception: HawatelPS::HawatelPSException

Inherits:
Exception
  • Object
show all
Defined in:
lib/hawatel_ps/shared/hawatelps_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



8
9
10
# File 'lib/hawatel_ps/shared/hawatelps_exception.rb', line 8

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

Instance Method Details

#exception_enrichment(args) ⇒ Object (private)



13
14
15
16
17
18
19
# File 'lib/hawatel_ps/shared/hawatelps_exception.rb', line 13

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