class ChefApply::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_apply/errors/standard_error_resolver.rb, line 38 def self.deps # Avoid loading additional includes until they're needed require "socket" unless defined?(Socket) require "openssl" unless defined?(OpenSSL) end
resolve_exception(exception)
click to toggle source
# File lib/chef_apply/errors/standard_error_resolver.rb, line 6 def self.resolve_exception(exception) deps show_log = true show_stack = true case exception when OpenSSL::SSL::SSLError if exception.message =~ /SSL.*verify failed.*/ id = "CHEFNET002" show_log = false show_stack = false end when SocketError then id = "CHEFNET001"; show_log = false; show_stack = false end if id.nil? exception else e = ChefApply::Error.new(id, exception.message) e.show_log = show_log e.show_stack = show_stack e end end
unwrap_exception(wrapper)
click to toggle source
# File lib/chef_apply/errors/standard_error_resolver.rb, line 34 def self.unwrap_exception(wrapper) resolve_exception(wrapper.contained_exception) end
wrap_exception(original, target_host = nil)
click to toggle source
# File lib/chef_apply/errors/standard_error_resolver.rb, line 29 def self.wrap_exception(original, target_host = nil) resolved_exception = resolve_exception(original) WrappedError.new(resolved_exception, target_host) end