log the ErrorReport id after creating it

And log some basic ErrorReport info if creating it fails

Change-Id: I4853569f6a1107321bc3bc05e7fa413a69996a6e
Reviewed-on: https://gerrit.instructure.com/15981
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
This commit is contained in:
Brian Palmer 2012-12-10 16:21:03 -07:00
parent f3d8cdd94c
commit fcc4b6655c
1 changed files with 11 additions and 1 deletions

View File

@ -69,7 +69,17 @@ class ErrorReport < ActiveRecord::Base
ActiveRecord::Base::ConnectionSpecification.with_environment(nil) do
report = ErrorReport.new
report.assign_data(opts)
report.save
begin
report.save!
Rails.logger.info("Created ErrorReport ID #{report.global_id}")
rescue => e
Rails.logger.error("Failed creating ErrorReport: #{e.inspect}")
Rails.logger.error("Original error: #{opts[:message]}")
Rails.logger.error("Original exception: #{opts[:exception_message]}") if opts[:exception_message]
@exception.backtrace.each do |line|
Rails.logger.error("Trace: #{line}")
end if @exception
end
report
end
end