Fix notify bug; bette crash dump subject

This commit is contained in:
Seth Call 2021-02-03 10:57:44 -06:00
parent 877ea031d1
commit e1d0fe2760
4 changed files with 17 additions and 5 deletions

View File

@ -1,7 +1,7 @@
class Spacer
def self.spacer(val, row)
percentage = (val / row.total * 100).round(1).to_s
percentage = ((val * 100) / row.total.to_f).round(1).to_s
('%-5.5s' % percentage).gsub(' ', ' ') + '% - ' + val.to_s
end
end

View File

@ -42,7 +42,7 @@ module JamRuby
end
def created_date
self.created_at.getutc.iso8601.to_s
self.created_at.nil? ? Time.now.getutc.iso8601.to_s : self.created_at.getutc.iso8601.to_s
end
def photo_url

View File

@ -662,8 +662,9 @@ class ApiUsersController < ApiController
@dump.description = params[:description]
@dump.fsize = params[:fsize]
@dump.crash_context = params[:crash_context]
send_email = params[:send_email]
if send_email.nil?
if params.has_key?(:send_email)
send_email = params[:send_email]
else
send_email = true
end
@ -705,6 +706,11 @@ class ApiUsersController < ApiController
context = "#{description.capitalize} Context:\n\n#{@dump.crash_context}\n"
subject = "#{description.capitalize} - #{@dump.session_id}"
if description == 'crash'
# preserve old behavior for crash dumps; Peter has filters for this format
subject = "Crash for #{@dump.client_type} - #{user.email}, on #{crash_date}"
end
if user
body = "Client #{description} for user #{user.email} (#{user.name})\n"
body << "User admin url: #{user.admin_url}\n"

View File

@ -43,7 +43,13 @@ module JamWebsockets
puts "unhandled error #{e.backtrace}"
@log.error "unhandled error #{e}"
@log.error "unhandled error #{e.backtrace}"
#Bugsnag.notify(e)
# SHOULD WE JUST DIE HERE? This was seen in production, and the gateway stopped after this!!!
begin
Bugsnag.notify(e)
rescue => bugsnag_e
puts "unable to report to bugsnag #{bugsnag_e}"
@log.error "unable to report to bugsnag #{bugsnag_e}"
end
}
EventMachine.run do