summaryrefslogtreecommitdiff
path: root/lib/chef/audit
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-05-15 11:42:28 -0700
committerBryan McLellan <btm@loftninjas.org>2015-05-27 14:16:26 -0400
commit7db21a6a7745e4cc7b774ab49447e1fcb68fa1f6 (patch)
treed8509962d9449daa3e83e3ce72f72d8d7b9134dd /lib/chef/audit
parente2a974f008d8635a37acaff2964404f3653b3a33 (diff)
downloadchef-7db21a6a7745e4cc7b774ab49447e1fcb68fa1f6.tar.gz
Skip adding backtrace to error message if unset.
Diffstat (limited to 'lib/chef/audit')
-rw-r--r--lib/chef/audit/audit_reporter.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/audit/audit_reporter.rb b/lib/chef/audit/audit_reporter.rb
index 1ed79bb42f..030ae34201 100644
--- a/lib/chef/audit/audit_reporter.rb
+++ b/lib/chef/audit/audit_reporter.rb
@@ -120,7 +120,11 @@ class Chef
if @exception || error
errors = [@exception, error].uniq.compact
- errors_messages = errors.map { |err| "#{err.class.to_s}: #{err.message}\n#{err.backtrace.join("\n")}" }
+ errors_messages = errors.map do |err|
+ msg = "#{err.class.to_s}: #{err.message}"
+ msg << "\n#{err.backtrace.join("\n")}" if err.backtrace
+ msg
+ end
run_data[:error] = errors_messages.join("\n")
end