Class: FastlaneCore::CrashReporting
- Inherits:
-
Object
- Object
- FastlaneCore::CrashReporting
- Defined in:
- lib/fastlane_core/crash_reporting/crash_reporting.rb
Constant Summary collapse
- URL =
'https://02c6a8be5bd4425389706655f3657f5c:[email protected]/55281'
Class Method Summary collapse
- .enable ⇒ Object
- .enabled? ⇒ Boolean
- .file_path ⇒ Object
- .handle_crash(ex) ⇒ Object
- .send_crash(ex) ⇒ Object
- .show_message ⇒ Object
Class Method Details
.enable ⇒ Object
9 10 11 12 13 14 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 9 def enable File.write(file_path, "1") puts "Successfully enabled crash reporting for future crashes".green puts "This will only send the stack trace the installed gems to sentry".green puts "Thanks for helping making fastlane better".green end |
.enabled? ⇒ Boolean
16 17 18 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 16 def enabled? File.exist?(file_path) end |
.file_path ⇒ Object
5 6 7 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 5 def file_path File.(File.join('~/.fastlane_crash_reporting')) end |
.handle_crash(ex) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 29 def handle_crash(ex) unless enabled? raise ex end raise ex if Helper.test? send_crash(ex) end |
.send_crash(ex) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 40 def send_crash(ex) # https://github.com/getsentry/raven-ruby/wiki/Advanced-Configuration require 'raven' require 'json' require 'fastlane_core/crash_reporting/clean_stack_trace' Raven.configure do |config| config.dsn = URL config.logger = Logger.new('/dev/null') # we couldn't care less config.sanitize_fields = %w(server_name) config.processors << Raven::Processor::CleanStackTrace end Raven::Context.clear! # we don't want to transfer things like the host name crash = Raven.capture_exception(ex) path = "/tmp/sentry_#{crash.id}.json" File.write(path, JSON.pretty_generate(crash.to_hash)) puts "Successfully submitted crash report. If this is a problem with one of the tools you want to report".yellow puts "please submit an issue on GitHub and attach the following number to it: '#{crash.id}'".yellow puts "Also stored the crash report locally '#{path}'".yellow rescue => ex Helper.log.debug ex # We don't want crash reporting to cause crash end |
.show_message ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/fastlane_core/crash_reporting/crash_reporting.rb', line 20 def puts "-------------------------------------------------------------------------------------------".yellow puts "😨 An error occured. Please enable crash reports using `fastlane enable_crash_reporting`".yellow puts "👍 This makes resolving issues much easier and helps improving fastlane".yellow puts "🔒 The reports might contain personal data, but will be stored securely on getsentry.com".yellow puts "✨ Once crash reporting is enabled, you have much cleaner output when something goes wrong".yellow puts "-------------------------------------------------------------------------------------------".yellow end |