Sha256: 37a2b6721a5f06cf0000ad172ee1ef4a7c8e477f35bbb4455fd43ccf9e262b0a

Contents?: true

Size: 826 Bytes

Versions: 7

Compression:

Stored size: 826 Bytes

Contents

module SolidErrors
  class Occurrence < Record
    belongs_to :error, class_name: "SolidErrors::Error"

    after_create_commit :send_email, if: -> { SolidErrors.send_emails? && SolidErrors.email_to.present? }

    # The parsed exception backtrace. Lines in this backtrace that are from installed gems
    # have the base path for gem installs replaced by "[GEM_ROOT]", while those in the project
    # have "[PROJECT_ROOT]".
    # @return [Array<{:number, :file, :method => String}>]
    def parsed_backtrace
      return @parsed_backtrace if defined? @parsed_backtrace

      @parsed_backtrace = parse_backtrace(backtrace.split("\n"))
    end

    private

    def parse_backtrace(backtrace)
      Backtrace.parse(backtrace)
    end

    def send_email
      ErrorMailer.error_occurred(self).deliver_later
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solid_errors-0.6.1 app/models/solid_errors/occurrence.rb
solid_errors-0.6.0 app/models/solid_errors/occurrence.rb
solid_errors-0.5.0 app/models/solid_errors/occurrence.rb
solid_errors-0.4.3 app/models/solid_errors/occurrence.rb
solid_errors-0.4.2 app/models/solid_errors/occurrence.rb
solid_errors-0.4.1 app/models/solid_errors/occurrence.rb
solid_errors-0.4.0 app/models/solid_errors/occurrence.rb