summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-05-21 11:43:31 -0700
committerBryan McLellan <btm@loftninjas.org>2015-05-27 14:16:31 -0400
commitce7e7c1a7d1538ffd3e14e6777424ec538a860c4 (patch)
treee540e7d8c6692e95e6ec2e781d0ec8c9727b898e
parent44fb5b0f1987a0c6285a7a1f0b6b4d4b2d455ae0 (diff)
downloadchef-ce7e7c1a7d1538ffd3e14e6777424ec538a860c4.tar.gz
Give captured exception a meaningful name
-rw-r--r--lib/chef/audit/audit_reporter.rb10
-rw-r--r--spec/unit/audit/audit_reporter_spec.rb4
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/audit/audit_reporter.rb b/lib/chef/audit/audit_reporter.rb
index fd3d13dd89..b74bf07b8b 100644
--- a/lib/chef/audit/audit_reporter.rb
+++ b/lib/chef/audit/audit_reporter.rb
@@ -34,7 +34,7 @@ class Chef
@rest_client = rest_client
# Ruby 1.9.3 and above "enumerate their values in the order that the corresponding keys were inserted."
@ordered_control_groups = Hash.new
- @exception = nil
+ @audit_phase_error = nil
end
def run_context
@@ -60,7 +60,7 @@ class Chef
# known control groups.
def audit_phase_failed(error)
# The stacktrace information has already been logged elsewhere
- @exception = error
+ @audit_phase_error = error
Chef::Log.debug("Audit Reporter failed.")
ordered_control_groups.each do |name, control_group|
audit_data.add_control_group(control_group)
@@ -120,9 +120,9 @@ class Chef
Chef::Log.debug("Sending audit report (run-id: #{audit_data.run_id})")
run_data = audit_data.to_hash
- if @exception
- error_info = "#{@exception.class}: #{@exception.message}"
- error_info << "\n#{@exception.backtrace.join("\n")}" if @exception.backtrace
+ if @audit_phase_error
+ error_info = "#{@audit_phase_error.class}: #{@audit_phase_error.message}"
+ error_info << "\n#{@audit_phase_error.backtrace.join("\n")}" if @audit_phase_error.backtrace
run_data[:error] = error_info
end
diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb
index f2d247644a..75c96155da 100644
--- a/spec/unit/audit/audit_reporter_spec.rb
+++ b/spec/unit/audit/audit_reporter_spec.rb
@@ -95,7 +95,7 @@ describe Chef::Audit::AuditReporter do
:backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) }
before do
- reporter.instance_variable_set(:@exception, audit_error)
+ reporter.instance_variable_set(:@audit_phase_error, audit_error)
end
it "reports an error" do
@@ -264,7 +264,7 @@ EOM
context "when some prior exception is stored" do
before do
- reporter.instance_variable_set(:@exception, audit_error)
+ reporter.instance_variable_set(:@audit_phase_error, audit_error)
end
it "reports the prior error" do