Sha256: 4d2daf2539b6883e68e7519ac681f75f36c2fb8f3d81b43215b94f9f67e0dc50

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

module Zikrash
  class ExceptionInfo
    attr_accessor :exception_class
    attr_accessor :message
    attr_accessor :full_backtrace
    attr_accessor :location
    attr_accessor :relevant_code

    def initialize(exception)
      self.exception_class = exception.is_a?(Class) ? exception.to_s : exception.class.to_s
      self.message = exception.message
      self.full_backtrace = exception.backtrace
      self.location = exception.backtrace.first
      self.relevant_code = CodeExtractor.new(exception.backtrace.first).result
      self
    end

    def data
      {
          class: exception_class,
          message: message,
          full_backtrace: full_backtrace,
          location: location,
          relevant_code: relevant_code
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zikrash-0.1.1 lib/zikrash/exception_info.rb