Class: ChefApply::StandardErrorResolver
- Inherits:
-
Object
- Object
- ChefApply::StandardErrorResolver
- Defined in:
- lib/chef_apply/error.rb
Overview
Provides mappings of common errors that we don’t explicitly handle, but can offer expanded help text around.
Class Method Summary collapse
- .deps ⇒ Object
- .resolve_exception(exception) ⇒ Object
- .unwrap_exception(wrapper) ⇒ Object
- .wrap_exception(original, target_host = nil) ⇒ Object
Class Method Details
.deps ⇒ Object
101 102 103 104 105 |
# File 'lib/chef_apply/error.rb', line 101 def self.deps # Avoid loading additional includes until they're needed require "socket" require "openssl" end |
.resolve_exception(exception) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/chef_apply/error.rb', line 69 def self.resolve_exception(exception) deps show_log = true show_stack = true case exception when OpenSSL::SSL::SSLError if exception. =~ /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.) e.show_log = show_log e.show_stack = show_stack e end end |
.unwrap_exception(wrapper) ⇒ Object
97 98 99 |
# File 'lib/chef_apply/error.rb', line 97 def self.unwrap_exception(wrapper) resolve_exception(wrapper.contained_exception) end |
.wrap_exception(original, target_host = nil) ⇒ Object
92 93 94 95 |
# File 'lib/chef_apply/error.rb', line 92 def self.wrap_exception(original, target_host = nil) resolved_exception = resolve_exception(original) WrappedError.new(resolved_exception, target_host) end |