Class: Hpe3parSdk::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/Hpe3parSdk/util.rb

Class Method Summary collapse

Class Method Details

.log_exception(exception, caller_location) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/Hpe3parSdk/util.rb', line 22

def self.log_exception(exception, caller_location)
  formatted_stack_trace = exception.backtrace
                              .map { |line| "\t\tfrom #{line}" }
                              .join($/)
  err_msg = "(#{caller_location}) #{exception}#{$/}  #{formatted_stack_trace}"
  Hpe3parSdk.logger.error(err_msg)
end

.merge_hash(hash1, hash2) ⇒ Object

Raises:

  • (TypeError)


14
15
16
17
18
19
20
# File 'lib/Hpe3parSdk/util.rb', line 14

def self.merge_hash(hash1, hash2)
  raise TypeError, 'hash1 is not a hash' unless hash1.class == Hash
  raise TypeError, 'hash2 is not a hash' unless hash2.class == Hash

  hash3 = hash2.merge(hash1)
  hash3
end