Parent

Class/Module Index [+]

Quicksearch

Chef::Formatters::ErrorInspectors::CookbookSyncErrorInspector

CookbookSyncErrorInspector

Generates human-friendly explanations for errors encountered during cookbook sync.

Attributes

cookbooks[R]
exception[R]

Public Class Methods

new(cookbooks, exception) click to toggle source
# File lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb, line 38
def initialize(cookbooks, exception)
  @cookbooks, @exception = cookbooks, exception
end

Public Instance Methods

add_explanation(error_description) click to toggle source
# File lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb, line 42
def add_explanation(error_description)
  case exception
  when *NETWORK_ERROR_CLASSES
    describe_network_errors(error_description)
  when Net::HTTPServerException, Net::HTTPFatalError
    humanize_http_exception(error_description)
  else
    error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}")
  end
end
config() click to toggle source
# File lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb, line 53
def config
  Chef::Config
end
humanize_http_exception(error_description) click to toggle source
# File lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb, line 57
def humanize_http_exception(error_description)
  response = exception.response
  case response
  when Net::HTTPUnauthorized
    # TODO: this is where you'd see conflicts b/c of username/clientname stuff
    describe_401_error(error_description)
  when Net::HTTPBadRequest
    describe_400_error(error_description)
  when Net::HTTPNotFound
  when Net::HTTPInternalServerError
    describe_500_error(error_description)
  when Net::HTTPBadGateway, Net::HTTPServiceUnavailable
    describe_503_error(error_description)
  else
    describe_http_error(error_description)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.