module ChefCLI::NestedExceptionWithInspector

Attributes

cause[R]
inspector[R]

Public Class Methods

new(message, cause) click to toggle source
Calls superclass method
# File lib/chef-cli/service_exceptions.rb, line 32
def initialize(message, cause)
  super(message)
  @message = message
  @inspector = inspector_for(cause)
  @cause = cause
end

Public Instance Methods

extended_error_info() click to toggle source
# File lib/chef-cli/service_exceptions.rb, line 43
def extended_error_info
  inspector.extended_error_info
end
message() click to toggle source
# File lib/chef-cli/service_exceptions.rb, line 47
def message
  @message
end
reason() click to toggle source
# File lib/chef-cli/service_exceptions.rb, line 39
def reason
  "(#{cause.class.name}) #{inspector.message}"
end
to_s() click to toggle source
# File lib/chef-cli/service_exceptions.rb, line 51
def to_s
  "#{message}\nCaused by: #{reason}"
end

Private Instance Methods

inspector_for(exception) click to toggle source
# File lib/chef-cli/service_exceptions.rb, line 57
def inspector_for(exception)
  if exception.respond_to?(:response)
    ServiceExceptionInspectors::HTTP.new(exception)
  else
    ServiceExceptionInspectors::Base.new(exception)
  end
end