summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2016-08-03 17:09:48 +0100
committerGitHub <noreply@github.com>2016-08-03 17:09:48 +0100
commit4254b472c2a17a1e252d4dbea5042e4ab39f8500 (patch)
tree882af48153116b6264b69e03c22f8a841a60fdfa
parent0ebee798d1c7e6ca4c84aa3f468ba12b5f78961d (diff)
parente143c2a6a6c18097cf2e51620ec148646c48069c (diff)
downloadchef-4254b472c2a17a1e252d4dbea5042e4ab39f8500.tar.gz
Merge pull request #3354 from chef/jdm/logexception
Log cause chain for exceptions
-rw-r--r--lib/chef/application.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index c377ffdb36..7396051678 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -352,6 +352,13 @@ class Chef
class << self
def debug_stacktrace(e)
message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}"
+
+ cause = e.cause if e.respond_to?(:cause)
+ while cause != nil
+ message << "\n\n>>>> Caused by #{cause.class}: #{cause}\n#{cause.backtrace.join("\n")}"
+ cause = cause.respond_to?(:cause) ? cause.cause : nil
+ end
+
chef_stacktrace_out = "Generated at #{Time.now}\n"
chef_stacktrace_out += message