class ChefCore::Errors::StandardErrorResolver

Provides mappings of common errors that we don't explicitly handle, but can offer expanded help text around.

Public Class Methods

deps() click to toggle source
# File lib/chef_core/errors/standard_error_resolver.rb, line 31
def self.deps
  # Avoid loading additional includes until they're needed
  require "socket"
  require "openssl"
end
resolve_exception(exception) click to toggle source
# File lib/chef_core/errors/standard_error_resolver.rb, line 6
def self.resolve_exception(exception)
  deps
  case exception
  when OpenSSL::SSL::SSLError
    if exception.message =~ /SSL.*verify failed.*/
      id = "CHEFNET002"
    end
  when SocketError then id = "CHEFNET001"
  end
  if id.nil?
    exception
  else
    ChefCore::Error.new(id, exception.message)
  end
end
unwrap_exception(wrapper) click to toggle source
# File lib/chef_core/errors/standard_error_resolver.rb, line 27
def self.unwrap_exception(wrapper)
  resolve_exception(wrapper.contained_exception)
end
wrap_exception(original, target_host = nil) click to toggle source
# File lib/chef_core/errors/standard_error_resolver.rb, line 22
def self.wrap_exception(original, target_host = nil)
  resolved_exception = resolve_exception(original)
  WrappedError.new(resolved_exception, target_host)
end