Sha256: 897ff80c737fcdf7da1da1b58c045c8426f266ea02c86afcbbd265172a330f3a

Contents?: true

Size: 1.64 KB

Versions: 264

Compression:

Stored size: 1.64 KB

Contents

module FastlaneCore
  class CrashReportGenerator
    class << self
      def generate(exception: nil)
        message = format_crash_report_message(exception: exception)
        crash_report_payload(message: message)
      end

      private

      def format_crash_report_message(exception: nil)
        return if exception.nil?
        backtrace = exception.respond_to?(:trimmed_backtrace) ? exception.trimmed_backtrace : exception.backtrace
        backtrace = FastlaneCore::CrashReportSanitizer.sanitize_backtrace(backtrace: backtrace).join("\n")

        if exception.fastlane_crash_came_from_plugin?
          message = '[PLUGIN_CRASH]'
        elsif exception.respond_to?(:prefix)
          message = exception.prefix
        else
          message = '[EXCEPTION]'
        end

        message += ': '

        if exception.respond_to?(:crash_report_message)
          exception_message = FastlaneCore::CrashReportSanitizer.sanitize_string(string: exception.crash_report_message)
        else
          exception_message = "#{exception.class.name}: #{FastlaneCore::CrashReportSanitizer.sanitize_string(string: exception.message)}"
        end

        message += exception_message
        message = message[0..100]
        message += "\n" unless exception.respond_to?(:could_contain_pii?) && exception.could_contain_pii?
        message + backtrace
      end

      def crash_report_payload(message: '')
        {
          'eventTime' => Time.now.utc.to_datetime.rfc3339,
          'serviceContext' => {
            'service' => 'fastlane',
            'version' => Fastlane::VERSION
          },
          'message' => message
        }.to_json
      end
    end
  end
end

Version data entries

264 entries across 264 versions & 1 rubygems

Version Path
fastlane-2.63.0.beta.20171021010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.63.0.beta.20171020010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.63.0.beta.20171019010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.63.0.beta.20171018010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171017010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171016010004 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171015010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171014010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171011010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.62.0.beta.20171010010004 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171009010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171008010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171007010004 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171006010004 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171005010003 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.61.0.beta.20171004010004 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.60.1 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb
fastlane-2.60.0 fastlane_core/lib/fastlane_core/crash_reporter/crash_report_generator.rb