Module: ChefDK::NestedExceptionWithInspector

Included in:
ChefRunnerError, PolicyfileNestedException
Defined in:
lib/chef-dk/service_exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



29
30
31
# File 'lib/chef-dk/service_exceptions.rb', line 29

def cause
  @cause
end

#inspectorObject (readonly)

Returns the value of attribute inspector.



30
31
32
# File 'lib/chef-dk/service_exceptions.rb', line 30

def inspector
  @inspector
end

Instance Method Details

#extended_error_infoObject



43
44
45
# File 'lib/chef-dk/service_exceptions.rb', line 43

def extended_error_info
  inspector.extended_error_info
end

#initialize(message, cause) ⇒ Object



32
33
34
35
36
37
# File 'lib/chef-dk/service_exceptions.rb', line 32

def initialize(message, cause)
  super(message)
  @message = message
  @inspector = inspector_for(cause)
  @cause = cause
end

#messageObject



47
48
49
# File 'lib/chef-dk/service_exceptions.rb', line 47

def message
  @message
end

#reasonObject



39
40
41
# File 'lib/chef-dk/service_exceptions.rb', line 39

def reason
  "(#{cause.class.name}) #{inspector.message}"
end

#to_sObject



51
52
53
# File 'lib/chef-dk/service_exceptions.rb', line 51

def to_s
  "#{message}\nCaused by: #{reason}"
end