summaryrefslogtreecommitdiff
path: root/lib/chef/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/application.rb')
-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